Hello all,
i have run successfully the code in the case bellow for a Document.
When applying the same code for a different object type, Dynamic Document, it does not record in the variable of the workflow the value of the attribute.
I have tried the following:
try {
wt.epm.EPMDocument doc = (wt.epm.EPMDocument) primaryBusinessObject;
//get the attributes of the document.
wt.iba.value.IBAHolder holder = wt.iba.value.service.IBAValueHelper.service.refreshAttributeContainerWithoutConstraints(doc);
wt.iba.value.DefaultAttributeContainer ac = (wt.iba.value.DefaultAttributeContainer) holder.getAttributeContainer();
if (ac != null) {
wt.iba.value.litevalue.AbstractValueView[] avalues = ac.getAttributeValues();
for (int i=0;i<avalues.length;i++) {
wt.iba.value.litevalue.AbstractValueView val = avalues[i];
System.out.println("checking attribute: <" + val.getDefinition().getName() + "> with value= <" + val.getLocalizedDisplayString() + ">");
if (val.getDefinition().getName().equals("com.bicworld.Type")) {
ditatype= val.getLocalizedDisplayString();
break;
}
}
}
}catch(Exception e) { System.out.println("Caught Exception:" + e.toString()); }
I have also tried to use the Persistable Adapter as per below, but still the same problem.
try {
wt.epm.EPMDocument doc = (wt.epm.EPMDocument) primaryBusinessObject;
com.ptc.core.lwc.server.PersistableAdapter obj = new com.ptc.core.lwc.server.PersistableAdapter(doc,null,null,null);
obj.load("com.bicworld.Type");
ditatype = (String)obj.get("com.bicworld.Type");
}catch(Exception e) { System.out.println("Caught Exception:" + e.toString()); }
Any idea why is that happening?
Thank you in advance
Solved! Go to Solution.
I don't use the IBA API for a while, but I don't think the method "getLocalizedDisplayString()" is the right one (I would assume its name to be more something like getValue()).
Anyways, I suggest you to use the PersistableAdapter.
The reason might be somewhere else. Is you PBO really a DD / EPMDocument ?
Hi,
I would suggest the second option.
Anyway, both should work (but I think you made a mistake in the first attempt, I think it should be value):
ditatype= val.getLocalizedDisplayString()
Did you tried to add some debug output (using System.out.println(...)) ?
PersistableAdapter persistableAdapter = new PersistableAdapter(persistable, null, Locale.US, null); persistableAdapter.load(attrName); apiReturn = persistableAdapter.getAsString(attrName);
Thank you for your reply, yes i have used debug output, but i cannot see anything in the logs.
When you say mistake in the first option, could you be more specific?
Thank you
I don't use the IBA API for a while, but I don't think the method "getLocalizedDisplayString()" is the right one (I would assume its name to be more something like getValue()).
Anyways, I suggest you to use the PersistableAdapter.
The reason might be somewhere else. Is you PBO really a DD / EPMDocument ?