Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X
We need to configure a business process in which we are using the Default "Promotion Request Approval Process" that is available OOTB. We want to stop the users from selecting themselves as an Approver in the Promotion Process.
PTC Tech support said this isn't possible. But doesn't this kill the process by itself? When the process isn't fool proof to stop the user selecting himself as an approver what is the use of it then? Is this achievable through any configuration options?
Thanks in advance!
OOTB this isn't possible for some alternative customization see below thread
Re: Prevent user from selecting themselves approve... - PTC Community
Thanks
Shreyas
I have not tested the following, but it might be worth a try.
Get rid of the Approver role in the workflow activity.
Into that workflow activity, put in a role from the Context Team page.
Choose an individual (or group) to assign that role on the Context Team page.
Create a customized layout (through the use of a sub/soft-type) to remove the 'Approver' field.
If it works, then the Approver can never be chosen and it will always revert to the person/group assigned to that role on the Context Team page. Of course, this means less flexibility but sometimes that's worth it.
Easiest option would be to modify the workflow to include a Conditional check immediately after the Start to compare the Creator and the Approver, and then if true send a new user task to the Creator saying "Fix Invalid Participants" or something along those lines with a Set Up Participants tab selected so they pick someone new.
Hi Amar,
The form delegate class PromotionParticipantsFormDelegate is marked supported. If you want to provide an error you should extend com.ptc.windchill.enterprise.maturity.forms.delegates.PromotionParticipantsFormDelegate and should override the preprocess method and call getParticipantsToProcess method to validate that the current user is not selected as an approver.
Check the following code, I would make appropriate changes if I am using WTGroups , I have hard-coded the casting to WTUser:
@Override
public FormResult preProcess(NmCommandBean commandBean, List<ObjectBean> objectBeans)
throws WTException {
// TODO Auto-generated method stub
//getParticipantsToProcess(arg0)
for (ObjectBean objectBean : objectBeans) {
Object object = objectBean.getObject();
if (object instanceof LifeCycleManaged) {
HashMap mapp= (HashMap) getParticipantsToProcess(objectBean);
Iterator it = mapp.entrySet().iterator();
while (it.hasNext()) {
Map.Entry pair = (Map.Entry)it.next();
Iterator iter = ((Set)pair.getValue()).iterator();
while (iter.hasNext()) {
WTUser principal=(WTUser) iter.next();
WTUser Sessionuser= (WTUser) SessionHelper.manager.getPrincipal();
//System.out.println(principal+"--"+Sessionuser);
/*
* Note pair.getKey() will give you the role, you can execute the following only for a particular role
*
*/
if (principal.getName().equalsIgnoreCase(Sessionuser.getName())) {
FormResult result;
FeedbackMessage errors= new FeedbackMessage();
errors.addMessage("You cannot select yourself as "+ pair.getKey()+ " Please select any other user");
result = new FormResult(FormProcessingStatus.FAILURE);
result.addFeedbackMessage(errors);
return result;
}
}
}
}
}
return super.preProcess(commandBean, objectBeans);
}
OOTB, delegate is registered in Windchill\codebase\config\actions\PromotionRequest-actions.xml (I will prefer to do this in custom*Action file, refer customization guide for more details.)
<action name="workflowParticipantsStep" required="false" preloadWizardPage="false">
<description>Promote wizard promotion objects step</description>
<command class="com.ptc.windchill.enterprise.maturity.forms.delegates.PromotionParticipantsFormDelegate" windowType="wizard_step"/>
</action>
Regards,
Bhushan
Thank You Bhushan you helped me very much.
Your answer is definitely the one...
Massimo
You can modify the existing Promotion Request Approval Process template to only display the approvers to the requestor in the 'Select Participants' screen.
Note: if you are concerned about modifying the OOTB templates, I suggest copying the template and creating your own version.
Save and check in the template
Hope this helps
Hi Amar,
we have done this through customizing the delegate class. Pretty similar to what Bhushan has explained.