Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X
Hi!
I modify team of the promotion notice by code. But inside the workflow promotion notice team have the default value. What can be wrong?
I have re-used the code mentioned in https://support.ptc.com/appserver/cs/view/solution.jsp?n=CS31366 many times and it works good.
Thank you
Binesh Kumar
Hi Binesh!
I can describe my work:
I' ve modified Promotion notice (PN) creation process. PN creation wizard call the doOperation() method of my own FormProcessor class that extend CreateObjectFormProcessor class.
public class CreatePRFormProcessor extends CreateObjectFormProcessor
{
@Override
public FormResult doOperation(NmCommandBean paramNmCommandBean, List<ObjectBean> paramList) throws WTException
{
FormResult localFormResult = new FormResult();
localFormResult.setStatus(FormProcessingStatus.SUCCESS);
if (paramList.size() > 0)
{
localFormResult = super.doOperation(paramNmCommandBean, paramList);
if (!continueProcessing(localFormResult))
{
return localFormResult;
}
for (ObjectBean localObjectBean : paramList)
{
if ((localObjectBean.getObject() != null) && ((localObjectBean.getObject() instanceof Persistable)))
{
Persistable pobj = (Persistable)localObjectBean.getObject();
WorkflowHelper.setPR(pobj, paramNmCommandBean);
}
}
}
return localFormResult;
}
}
super.doOperation(paramNmCommandBean, paramList); - create and stored the PN object.
WorkflowHelper.setPR(pobj, paramNmCommandBean); - handle the pobj (pobj is the PN object). In the setPR logic I work with the team of PN. But:
when I try to delete principals from PN team like: deletePrincipalTarget(role, wtpr.getPrincipal()) and role is the custom role the principals are not deleted from team. But if role is the OOTB role then principals are deleted well.
Any specific reason you are calculation team in From Processor, team calculation and role resolution is also depend on workflow. I would suggest preform any team related activities in workflow. Can you call your code in one expression robot in workflow just after start flag.
I am not sure how your Windchill is setup with context team, team template and workflow participants . Your code might be working for ootb role is because ootb role is getting resolved from context team and not working for custom role, because it is getting resolved from workflow .
Thanks
Shreyas
Hi Shreyas!
Calling my code in expression robot is working fine.
I have modified the third step of PN creation wizard, where user can modify the team in MVC component that look like the context team MVC component. This MVC component call my own session bean that keep the Team object. So if I want to get the team in the workflow expression robot I need the way of how to get session bean (or CommandBean) inside the workflow.
Hi Anton,
Your team calculation code works in Workflow Expression robot. It means there is something with team instance calculation. When you are saving the Promotion object along with it’s team from form processor. After that workflow is getting started on promotion request, so along with workflow team is again getting calculated .
See below article for how team works
https://support.ptc.com/appserver/cs/view/solution.jsp?n=CS36805
I am not sure the criticality of the customization request for you. But I would suggest is remove the participant table in from promotion request wizard and add setup participant activity in workflow.