Update GroupID for perticular document in TradingNetworks 46

Hi All,

I would like to know how to update GroupID of a particular document in TradingNetworks using TradingNetworks JAVA API.

Thanks
Vinay

Review the API doc for com.wm.app.tn.doc.BizDocEnvelope.

Hi Rob,
In pipeline I have BizDoc, I would like to change(update) GroupID of that document. Could you please kindly explain me more about BizDocEnvelope. Are there any built in service exists to update GroupID.

I don’t believe the group id can be set using flow services. You’ll need to write a Java service:

setGroupID
Inputs: bizdocID, groupID

BizDocEnvelope bizdoc = BizDocStore.getDocument(bizdocID, false);
bizdoc.setGroupId(groupID);

I’ve omitted all the pipeline interaction code but this should do what you need.

Vinay:

I guess I didn’t read the API doc closely enough.

“None of the setters will modify the contents of the database unless explicitly stated otherwise: this means it’s a bad idea to update documents after they’ve been saved (except maybe to add some attributes or content parts).”

So ideally you would set the group ID before it is written to the database. You might try to create the BizDocEnvelope using wm.tn.doc.:createNewEnvelope in a custom Java service, setting values as desired, and then call wm.tn:submit for processing. This should save the doc to the DB with your desired values.

You might also try the BizDocStore.updateAttributes static method. I’m not sure what “attributes” it supports so you’ll need to do some trial and error.

HTH