Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X
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
Solved: How to Check if Creater has added himself has a Pr... - PTC Community
https://support.ptc.com/appserver/cs/view/solution.jsp?n=CS180902
Hope it helps !!!
Thanks
Shreyas
Hi Paul,
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();
if((currentUser.toString()).equals(wfCreator.toString())){
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.
Regards,
Shirish
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.