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

Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X

string IBA from a WTDoc running through a workflow

jasonb13
7-Bedrock

string IBA from a WTDoc running through a workflow

I have created a wtdocument softype that kicks off a workflow when created. I am trying to pull a string attribute and assign a workflow variable the value of the attribute. However, the variable is not getting set.


I have a class file with the following code:


public static String getIBAString(WTObject pbo, String ibaName) throws WTException, RemoteException {
String retValue = ";
IBAHolder ibaHolder = (IBAHolder) pbo;
ibaHolder = IBAValueHelper.service.refreshAttributeContainer(ibaHolder, null, null, null);
DefaultAttributeContainer defAttCont = (DefaultAttributeContainer) ibaHolder.getAttributeContainer();
AttributeDefDefaultView attDef = IBADefinitionHelper.service.getAttributeDefDefaultViewByPath(ibaName);
AbstractValueView attValue[] = defAttCont.getAttributeValues(attDef);
if (attValue.length > 0 && attValue[0] instanceof StringValueDefaultView) {
retValue = attValue[0].getLocalizedDisplayString();
}
return retValue;
}


I am adding the followingexpressionto the start transition of the workflow specialProcess1 is the workflow variable and specialProcess is the wtdoc softype attribute.


specialProcess1 = com.fnmfg.FNWorkflowUtility.getIBAString((wt.fc.WTObject)primaryBusinessObject , "specialProcess");


This works when I am pulling the attribute from a change request so I am unsure where I am going wrong.

2 REPLIES 2

Hi Jason, there is a better method for this that works easily for PBO's. See info below. This is for WC10+. You can use a similar method to push values back into the IBA as well from the workflow. Pretty handy. There is more info in the forum on this if you search.

com.ptc.core.lwc.server.LWCNormalizedObject obj = new com.ptc.core.lwc.server.LWCNormalizedObject(primaryBusinessObject,null,null, null);
obj.load("MyAttribute");
Object softAttribValue = obj.get("MyAttribute ");
if (softAttribValue instanceof String) {
String MyType = (String) softAttribValue;

if (MyType.equals("Electrical")) {
result="IsElectrical";
} else if (MyType.equals("Software")) {
result="IsSoftware";
} else {
result="IsEngineering";
}
}



[cid:image001.gif@01CE02E2.27EBC3B0]

Steve Vinyard
Application Engineer

Thanks Steve I will give this a try.

Announcements


Top Tags