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?