cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X

Prevent user from selecting themselves approver?

pmodera
1-Visitor

Prevent user from selecting themselves approver?

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.

3 REPLIES 3
satre-2
12-Amethyst
(To:pmodera)

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.

Announcements


Top Tags