Specifically during a promotion request, I'm trying to create an expression robot to remove the creator from the list of approvers, although, limiting the user during creation wizard of the promotion request would be the most helpful. Any suggestions? I'm very new to Windchill Admin so if this is a simple question, I apologize.
check below links for the same question/issue
Hope it helps !!!
Alternatively you can also try below code snippet in Approve Promotion Request's Complete Transition. This will check if current logged in (session) user is a Promotion Notice creator:
wt.org.WTUser currentUser = (wt.org.WTUser)wt.session.SessionHelper.manager.getPrincipal();
wt.workflow.engine.WfProcess wfprocess = ((wt.workflow.work.WfAssignedActivity)self.getObject()).getParentProcess();
wt.org.WTPrincipalReference creatorReference = wfprocess.getCreator();
wt.org.WTPrincipal wfCreator = ((wt.org.WTPrincipalReference)creatorReference).getPrincipal();
throw new wt.util.WTException ( "ERROR: You cannot APPROVE your own promotion request.\nPlease reassign the task or ask Windchill Admins for help" );
I hope this helps you.
Shirishkumar Morkhade - does the exception message appear in the dialog for the user or does the exception only appear in the logs? If it does, then great because I have previously used a downstream conditional node to loop back if criteria is not met. In doing this I need to turn Task Notification off and have separate Notification Robots for new and returned Tasks. My approach is less than optimal from a User perspective but it was the only way I could get the messaging to the User. I did make Tech Support calls about how to control the message in the dialog that appears when a Transition condition is false was told it is not possible. F
Also - I don't see anything that would return false and restrict the completion of the Transition.