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

We are happy to announce the new Windchill Customization board! Learn more.

How do I construct the link to an assigned workflow task?

RandyJones
19-Tanzanite

How do I construct the link to an assigned workflow task?

Windchill 10.2 F000

I have a workflow (promotion request) in which I want to send an email from the Start transition of an assigned task. This is so I can customize the email as opposed to the OOTB email you get when you select "Send Notification".

If you select "Send Notification" the OOTB email sent contains a handy link to the task as shown below:
You have been assigned a Rework Promotion Request <.">http://YourWindchillServer.YourDomain.com/Windchill/app/#ptc1/tcomp/infoPage?oid=OR%3Awt.workflow.work.WorkItem%3A200517051&u8=1>.

The link looks like this:
http://YourWindchillServer.YourDomain.com/Windchill/app/#ptc1/tcomp/infoPage?oid=OR%3Awt.workflow.work.WorkItem%3A200517051&u8=1
3 REPLIES 3

I have a solution to my earlier question which was this:

> Windchill 10.2 F000
>
> I have a workflow (promotion request) in which I want to send an email from the Start transition
> of an assigned task. This is so I can customize the email as opposed to the OOTB email you get
> when you select "Send Notification".
>
> If you select "Send Notification" the OOTB email sent contains a handy link to the task as shown
> below:
> You have been assigned a Rework Promotion Request
> <.">http://YourWindchillServer.YourDomain.com/Windchill/app/#ptc1/tcomp/infoPage?oid=OR%3Awt.workflow.work.WorkItem%3A200517051&u8=1>.
>
> The link looks like this:
> http://YourWindchillServer.YourDomain.com/Windchill/app/#ptc1/tcomp/infoPage?oid=OR%3Awt.workflow.work.WorkItem%3A200517051&u8=1

Randy, I'm glad you found a "solution to your earlier question".  Would you be so kind as to share how you did it?  I see that you created an expression to set a variable prior to the email notification, but what is the URL link?  How do you get it?  I cannot figure out how to get the WorkItem #.

thanks, Clay

My current method of sending email with a link to the task. The code in the GetTaskURL expression robot is copied here:

String sig= "Here at PromotionRequest SendMail robot";

System.out.println(sig);
System.out.println(sig + " special_instructions = " + special_instructions);

wt.fc.QueryResult qr=wt.workflow.status.WfWorkflowStatusHelper.service.getProcessComponents((wt.workflow.engine.WfProcess)self.getObject());

while (qr.hasMoreElements())
{

	Object elem = qr.nextElement();

	if (elem instanceof wt.workflow.work.WfAssignedActivity)
	{

		wt.workflow.work.WfAssignedActivity activity =(wt.workflow.work.WfAssignedActivity)elem;
		System.out.println(sig + " activity.getName() = " + activity.getName());
		if(activity.getName().equalsIgnoreCase("Rework Promotion Request"))
		{

			java.util.Enumeration assignments = activity.getAssignments();

			wt.workflow.work.WfAssignment assignment = null;

			if( assignments.hasMoreElements()) assignment = ( wt.workflow.work.WfAssignment ) assignments.nextElement();

			if( assignment != null)
			{

				wt.fc.QueryResult workitems = wt.fc.PersistenceHelper.manager.navigate( assignment, wt.workflow.work.WorkItemLink.WORK_ITEM_ROLE, wt.workflow.work.WorkItemLink.class );

				if( workitems.hasMoreElements())
				{

					wt.workflow.work.WorkItem currentWorkItem = ( wt.workflow.work.WorkItem ) workitems.nextElement();

					com.ptc.netmarkets.model.NmOid contentOid = new com.ptc.netmarkets.model.NmOid(com.ptc.netmarkets.work.NmWorkItem.TYPE, currentWorkItem.getPersistInfo().getObjectIdentifier());

					com.ptc.netmarkets.util.beans.NmURLFactoryBean urlFactoryBean = new com.ptc.netmarkets.util.beans.NmURLFactoryBean ();

					urlFactoryBean.setRequestURI ( com.ptc.netmarkets.util.misc.NetmarketURL.BASEURL );

					taskURL = com.ptc.netmarkets.util.misc.NetmarketURL.buildURL ( urlFactoryBean, com.ptc.netmarkets.util.misc.NmAction.Type.OBJECT, com.ptc.netmarkets.util.misc.NmAction.Command.VIEW, contentOid, null);
					System.out.println(sig + " taskURL = " + taskURL);
				}

			}

		}

	}

}

Screenshots of work flow. "Rework Promotion Request" is the task. "GetTaskURL" is the expression robot. Note the "Start" action on the link to the GetTaskURL expression robot from the "Rework Promotion Request" task.

rework_email_workflow.png

 

 

Screenshot of the code (also copied and pasted above) in GetTaskURL:

 

getTaskURL_code.png

 

Top Tags