Trading Networks 10.3 | Administering and Monitoring B2B Transactions | webMethods Module for EDI | Processing Inbound TRADACOMS Documents Using Trading Networks | Trading Networks Attributes and EDI Documents When Using TRADACOMS | Managing Your Own Custom Attributes for EDI Documents When Using TRADACOMS | Setting Attribute Values at Run Time When Using TRADACOMS
 
Setting Attribute Values at Run Time When Using TRADACOMS
As with other standards, you must create a service to set the attribute values at run time when using TRADACOMS. To execute this service, include it as a parameter of the Execute a Service processing action in a Trading Networks processing rule. Note that your EDI document type or processing rule must use the Save Document to Database preprocessing action to save the document content and attributes to the database.
Create a service that performs the following logic:
*Obtain the values you want to use for each custom attribute.
*For each attribute, invoke the wm.tn.doc:setAttribute service to set the value of the attribute in the BizDocEnvelope.
*Invoke the wm.tn.doc:updateAttributes service to update the values of the attributes in the copy of the document that is saved in the Trading Networks database.
Example
Let’s say you are working with the File document type, and you want to associate the PurchaseOrderNumber attribute with an ORDERS document. To do so, you would:
1. Install the TN document type for the ORDERS document.
2. Create the PurchaseOrderNumber attribute.
3. Invoke the wm.b2b.editn:addAttributeTypeToBizDoc service to associate the PurchaseOrderNumber attribute with the TN document type for the ORDERS document.
4. Create a service that extracts the value for the PurchaseOrderNumber attribute from the ORDERS document, and assign this service as input to the Execute a Service processing action in the processing rule. Your service should do the following:
*Invoke the wm.tn.doc:setAttribute service to set the value for the attribute in the BizDocEnvelope
*Invoke wm.tn.doc:updateAttributes to update the attributes in the saved copy of the document in the Trading Networks database