Singapore PEPPOL Inbound Sales Order Template

You can include more fields in sales order created from inbound e-documents. For example, you can add Class, Department, or Location fields. To do this, you can edit the inbound e-document template. Then, in the field mapping, add lines of code for the additional fields. For more information, see Understanding Inbound E-Document Templates in JSON Format.

For reference, the following is the sample sales order template:

          <#ftl ns_prefixes={"A":"http://www.unece.org/cefact/namespaces/StandardBusinessDocumentHeader", "D":"urn:oasis:names:specification:ubl:schema:xsd:Order-2", "cac":"urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2", "cbc":"urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"}>
{
"otherrefnum": "${XML["A:StandardBusinessDocument"]["D:Order"]["cbc:ID"]}",
"memo": "${XML["A:StandardBusinessDocument"]["D:Order"]["cbc:Note"]}",
<#if custom["currency"]?has_content>
"currency":"${CUSTOM["currency"]}",
</#if>
"message": "${CUSTOM["message"]}",
<#if custom["salesrep"] != "">
"salesrep": "${CUSTOM["salesrep"]}",
</#if> 
<#if custom["shipdate"] != "">
"shipdate": "${CUSTOM["shipdate"]}",
</#if>
"shipaddress": {
"country": "${XML["D:Order"]["cac:Delivery"]["cac:DeliveryLocation"]["cac:Address"]["cac:Country"]["cbc:IdentificationCode"]}",
"addr1": "${XML["D:Order"]["cac:Delivery"]["cac:DeliveryLocation"]["cac:Address"]["cbc:StreetName"]}",
"addr2": "${XML["D:Order"]["cac:Delivery"]["cac:DeliveryLocation"]["cac:Address"]["cbc:AdditionalStreetName"]}",
"addr3": "${XML["D:Order"]["cac:Delivery"]["cac:DeliveryLocation"]["cac:Address"]["cac:AddressLine"]["cbc:Line"]}",
"city": "${XML["D:Order"]["cac:Delivery"]["cac:DeliveryLocation"]["cac:Address"]["cbc:CityName"]}",
"state": "${XML["D:Order"]["cac:Delivery"]["cac:DeliveryLocation"]["cac:Address"]["cbc:CountrySubentity"]}",
"zip": "${XML["D:Order"]["cac:Delivery"]["cac:DeliveryLocation"]["cac:Address"]["cbc:PostalZone"]}"
},
"item": [
<#assign index=0>
<#assign taxcodeString="taxcode_">
<#list XML["A:StandardBusinessDocument"]["D:Order"]["cac:OrderLine"]["cac:LineItem"] as item>
{
"item": "${item["cac:Item"]["cbc:Name"]}",
"quantity": "${item["cbc:Quantity"]}",
"rate": "${item["cac:Price"]["cbc:PriceAmount"]}",
"amount": "${item["cbc:LineExtensionAmount"]}",
"description": "${item["cac:Item"]["cbc:Description"]}",
"taxcode": "${CUSTOM[taxcodeString+index]}"
<#assign index++>
}
<#if item_has_next>,</#if>
</#list>
]
} 

        

General Notices