I have a workflow for a WTReferenceDocument soft type object. I also have custom attributes for the object. Once the workflow has started, I would at some point like to route the workflow based on the value of the attribute. How would I write the Routing expression in the conditional connector. Case in point, the possible values for the attribute are "Tim, Tom, Barry or Steve", The name of the attribute "Judge" and the object is a soft type of the WTReferenceDocument called. Summons.
In decision robot, make "Routing type" as 'Condotional' and in expression section get the value of that attribute.
Then based on that value, set the value of "result" as the path to be selected.
Hi Manishkumar,
That is what I want to do however I don't know how the code should look like and how do I call the attribute (IBA) of the PBO in the expression section.
Regards,
Hi Tshepo,
You can write following method in your workflow helper class:
-------------------------
public String getIBAValue(WTReferenceDocument objDoc,
String ibaName) {
wt.iba.value.IBAHolder holdProblemReport = (wt.iba.value.IBAHolder) objDoc;
com.ptc.core.lwc.server.LWCNormalizedObject orderHolderProblemReport = null;
String ibaValue = "";
try {
orderHolderProblemReport = new com.ptc.core.lwc.server.LWCNormalizedObject(
(wt.fc.Persistable) holdProblemReport, null, wt.util.WTContext
.getContext().getLocale(), null);
orderHolderProblemReport.load(ibaName);
ibaValue = (String) orderHolderProblemReport
.get(ibaName);
} catch (wt.util.WTException e) {
e.printStackTrace();
}
return ibaValue;
}
-------------------------
Call above method in expression section as below:
------
WTReferenceDocument pbo = (WTReferenceDocument)primaryBusinessObject;
ext.util.WF_Helper objHelper = new ext.util.WF_Helper();
String IBAValue = objHelper.getIBAValue(pbo, "IBA_internal_name");
------
Let me know if the answer was helpful or it is still not clear.
Regards,
Manish
Hi Manish,
I'm not really a java programmer, so there isn't an OOTB expression without first coding the method? Where do I find the wf helper class and secondly what are the implication of editing class, will it be retained when I do an upgrade.
Regards,
Tshepo
Hi Tshepo,
There is nothing OOTB like that.
Workflow Helper is not an OOTB cass that you can find in Windchill, but you need to write that class and this method in it.
Regards,
Manish
Thanks a lot Manish, Your responses and insight has helped a lot, I will speak to my IT and request guidance when it comes to the java part. I will let you know when I come right. Is there maybe a guide you can recommend for the above mentioned procedure.
Thanks and regards,
Tshepo
Hi Manish,
Can we use this below code of PTC Knowledge-base, CS129817,
if (primaryBusinessObject != null)
{
try
{
com.ptc.core.lwc.server.LWCNormalizedObject obj = new com.ptc.core.lwc.server.LWCNormalizedObject(primaryBusinessObject,null, java.util.Locale.US, new com.ptc.core.meta.common.DisplayOperationIdentifier());
obj.load("<soft_attribbute_name>");
java.lang.String string_value = (java.lang.String) obj.get("<soft_attribbute_name>");
System.out.println("Soft attibute value : " + string_value);
if ( string_value != null )
{
result = "Route1";
}
else
result="Route2";
}
catch ( Exception e )
{
e.printStackTrace();
}
}
Note: Additional details about LWCNormalizedObject API in Windchill Javadoc
LWCNormalizedObject is server side API
Regards,
Mahesh
HI Manishkumar Sojitra
I am Unable to Create the object of workflow helper in workflow its showing Class not found