Skip to main content
3-Newcomer
April 15, 2025
Question

Set Date Attribute to (Assigned Date + 5 Days) Using Workflow Transition Code in Windchill

  • April 15, 2025
  • 1 reply
  • 702 views

I need to get the Assigned Date from My Task once the activity is started. Using the self variable, I can retrieve the WFAssignment object that contains all task details. From this, I want to take the Assigned Date, add 5 days to it, and then set that new date to a date attribute using IBA.

Can anyone help me with example code that should be written in the Transition tab of the workflow for this?

1 reply

18-Opal
April 17, 2025

Very doable.

I’ve done similar for a company that wanted to reset due dates on tasks.

And for companies that wanted to send an alert 5 days before something was due.

 

Custom code for sure but it is doable.

3-Newcomer
April 17, 2025

Can you please share the example code it will be helpful to implement it in the workflow 

avillanueva
23-Emerald I
23-Emerald I
April 17, 2025

Here is something I did that validated need by date on change request in workflow:

java.util.Calendar c=java.util.Calendar.getInstance();
c.add(java.util.Calendar.DATE,21);
java.util.Date n=((wt.change2.WTChangeRequest2)primaryBusinessObject).getNeedDate();
if(n == null)
{
result="null";
}
else if (c.getTimeInMillis() < (n.getTime()))
{ 
 result="ok";
}
else
{
 result="notOK";
}