Question
SUMMARY Dynamically Set Workflow Activity
Adding summary:
Dynamic Activity Name (Activity Transition)
//Get the Activity
wt.workflow.engine.WfActivity myActivity = (wt.workflow.engine.WfActivity)self.getObject();
//Modify the Activity
myActivity.setName ("Work Order - " + task1Name); //task1Name is a String
//Save the Activity
myActivity = (wt.workflow.engine.WfActivity) wt.fc.PersistenceHelper.manager.save(myActivity);
Dynamic Activity Instructions
Add your String variable to the activity task instructions. Enclose the variable in curly braces.
{task1Instructions}
Dynamic Activity Participants (WFExpression)
if (task1User != null) //task1User is a wt.org.WTUser variable
{
//SET TEAM
wt.team.Team team = (wt.team.Team)((wt.team.TeamManaged)(self.getObject())).getTeamId().getObject();
//SET THE ROLES
wt.project.Role teamRole = wt.project.Role.toRole("TASK OWNER 1");
//REMOVE THE CURRENT PARTICIPANT
wt.org.WTPrincipal removeUser = null;
wt.team.TeamHelper.service.deleteRolePrincipalMap( teamRole,removeUser,team);
//ADD THE PARTICIPANTS TO THE TO_ROLES
wt.team.TeamHelper.service.addRolePrincipalMap( teamRole, task1User, team );
}
Dynamic Activity Due Date
Create and set a wt.workflow.engine.WfDueDate variable from a preceding task or from code.
Add the wt.workflow.engine.WfDueDate variable to the appropriate task as visible, required and read set to false. Set resettable to true.
Hope this helps,
Dax Williams
Business Administrator, Windchill
Lifetime Products, Inc.
-<">mailto:->
[Lifetime_Logo_BlkWhite_Sans_email sig]
Dynamic Activity Name (Activity Transition)
//Get the Activity
wt.workflow.engine.WfActivity myActivity = (wt.workflow.engine.WfActivity)self.getObject();
//Modify the Activity
myActivity.setName ("Work Order - " + task1Name); //task1Name is a String
//Save the Activity
myActivity = (wt.workflow.engine.WfActivity) wt.fc.PersistenceHelper.manager.save(myActivity);
Dynamic Activity Instructions
Add your String variable to the activity task instructions. Enclose the variable in curly braces.
{task1Instructions}
Dynamic Activity Participants (WFExpression)
if (task1User != null) //task1User is a wt.org.WTUser variable
{
//SET TEAM
wt.team.Team team = (wt.team.Team)((wt.team.TeamManaged)(self.getObject())).getTeamId().getObject();
//SET THE ROLES
wt.project.Role teamRole = wt.project.Role.toRole("TASK OWNER 1");
//REMOVE THE CURRENT PARTICIPANT
wt.org.WTPrincipal removeUser = null;
wt.team.TeamHelper.service.deleteRolePrincipalMap( teamRole,removeUser,team);
//ADD THE PARTICIPANTS TO THE TO_ROLES
wt.team.TeamHelper.service.addRolePrincipalMap( teamRole, task1User, team );
}
Dynamic Activity Due Date
Create and set a wt.workflow.engine.WfDueDate variable from a preceding task or from code.
Add the wt.workflow.engine.WfDueDate variable to the appropriate task as visible, required and read set to false. Set resettable to true.
Hope this helps,
Dax Williams
Business Administrator, Windchill
Lifetime Products, Inc.
-<">mailto:->
[Lifetime_Logo_BlkWhite_Sans_email sig]

