Skip to main content
Question

Trying to override the CancelClose button on a custom screen

  • April 17, 2026
  • 2 replies
  • 27 views

Joe Schmucker
Captain II
Forum|alt.badge.img+3

I have two GI’s, ICSCallLog, and ICSCallLogUser.  ICSCallLog is for use by Administrators.  It has an Entry Screen to open my custom screen when a row in the GI is selected.

The second GI ICSCallLogUser has a Condition to only show records where CreatedBy = @me.

When you open the custom screen while viewing the admin GI, then click the CloseCancel button, it returns the user to the ICSCallLog GI.

When you open the custom screen while viewing the user GI, then click the CloseCancel button, it returns the user to the ICSCallLog GI.  I want it to return to the ICSCallLogUser GI so that they only see their records.

I am thinking that I can add logic to the CancelClose action on my screen to redirect the user to the appropriate GI.

This is the code I am trying to use:


//[PXOverride]
public delegate IEnumerable CancelCloseDelegate(PXAdapter adapter);
[PXOverride]
[PXUIField]
[PXButton]
public IEnumerable CancelClose(PXAdapter adapter, CancelCloseDelegate baseMethod)
{
//see if current user is an Administrator
string username = this.Accessinfo.UserName;

UsersInRoles objUsers = SelectFrom<UsersInRoles>
.Where<UsersInRoles.username.IsEqual<@P.AsString>
.And<UsersInRoles.rolename.IsEqual<@P.AsString>>>.View.Select(this, username, "Administrator");

if (objUsers == null)
{
throw new PXRedirectToGIRequiredException("ICSCallLogUser") { Mode = PXBaseRedirectException.WindowMode.Same };
}
else
{
throw new PXRedirectToGIRequiredException("ICSCallLog") { Mode = PXBaseRedirectException.WindowMode.Same };
}

return baseMethod(adapter);
}

 

This code does not fire when the CancelClose button is clicked.   I don’t even know if my logic will work as I cannot get the code to fire.

I’ve tried putting [PXOverride] above the public delegate line, but no difference.

I’d love to be able to use the Entry Screen IC301010 in both GI’s but that is not allowed.

Any ideas?

 

 

 

 

 

2 replies

KrunalDoshi
Varsity III
Forum|alt.badge.img+1
  • Varsity III
  • April 20, 2026

Hi ​@Joe Schmucker,

I would suggest you set the Entry Screen for ICSCallLogUser GI to your custom screen and in ICSCallLog GI, you set the Navigation Target to your key field on Results grid so that it opens your custom screen. This way when user clicks on CloseCancel button, it will go to ICSCallLogUser GI and not ICSCallLog GI. Let me know this this helps.


Joe Schmucker
Captain II
Forum|alt.badge.img+3
  • Author
  • Captain II
  • April 20, 2026

Hi ​@KrunalDoshi   Thanks for taking the time to help me!  Let me try that. 

What I have done for now is to not use an entry point for EITHER GI, and in the navigation, I navigate to my screen as a popup window.  On the custom screen, I hid the closecancel button.  It is a viable workaround.