Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X
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.
Screenshot of the code (also copied and pasted above) in GetTaskURL: