Trading Networks 10.3 | Administering and Monitoring B2B Transactions | webMethods Module for EDI | Preparing to Process Inbound Non-TRADACOMS Documents Using Trading Networks | Trading Networks Attributes and EDI Documents | Managing Custom Attributes for EDI Documents | Setting the Attribute Values at Run Time
 
Setting the Attribute Values at Run Time
You must create a service to set the attribute values at run time. 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 an EDI ANSI X12 850 document, and you want to associate the PurchaseOrderNumber attribute with the 850 document. To do so, you would:
1. Install the TN document type for the 850 EDI 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 850 EDI document.
4. Create a service that extracts the value for the PurchaseOrderNumber attribute from the 850 EDI 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 wm.tn.doc:setAttribute to set the value of 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