Mapping Additional Fields in Vendor Bills Created from Inbound E-Documents
You can include more fields in vendor bills created from inbound e-documents. For example, you can add PO Number, 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.
Adding PO Number in Inbound Template Field Mapping
The Purchase Order Number is an example of a field that you can add to vendor bills to be created from inbound e-documents.
To add PO Number field mapping in the inbound e-document template:
-
Go to Setup > E-Documents > E-Document Templates.
-
Click the Edit link of Singapore PEPPOL Inbound vendor bill template.
-
In the JSON template field mapping, add the following line of code:
"createdfrom":"${XML["A:StandardBusinessDocument"]["D:Invoice"]["cac:OrderReference"]["cbc:ID"]}"
For reference, this line of code is highlighted in the following field mapping block of code, so that you will know where to add it.
<#ftl ns_prefixes={"A":"http://www.unece.org/cefact/namespaces/StandardBusinessDocumentHeader", "D":"urn:oasis:names:specification:ubl:schema:xsd:Invoice-2", "cac":"urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2", "cbc":"urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"}> { "tranid": "${XML["A:StandardBusinessDocument"]["D:Invoice"]["cbc:ID"]}", "trandate": "${CUSTOM["trandate"]}", "duedate": "${CUSTOM["duedate"]}", "createdfrom":"${XML["A:StandardBusinessDocument"]["D:Invoice"]["cac:OrderReference"]["cbc:ID"]}", "memo": "${XML["A:StandardBusinessDocument"]["D:Invoice"]["cbc:Note"]}", <#if CUSTOM["currency"]?has_content> "currency": "${CUSTOM["currency"]}", </#if> "location": "Parent Location", "item": [ <#assign index=0> <#assign taxcodeString="taxcode_"> <#list XML["A:StandardBusinessDocument"]["D:Invoice"]["cac:InvoiceLine"] as item> { "vendorcode": "${item["cac:Item"]["cbc:Name"]}", "vendorname": "${item["cac:Item"]["cbc:Name"]}", "quantity": "${item["cbc:InvoicedQuantity"]}", "rate": "${item["cac:Price"]["cbc:PriceAmount"]}", "amount":"${item["cbc:LineExtensionAmount"]}", "taxcode": "${CUSTOM[taxcodeString+index]}", "description": "${item["cac:Item"]["cbc:Name"]}", "inventorydetailreq":false <#assign index++> }<#if item_has_next>,</#if> </#list> ] }
-
Save the template.
When the system receives an inbound e-document from PEPPOL Singapore, the vendor bill to be created will have PO Number indicated. You can view The PO Number on the Related Record subtab, under Purchase Order.
However, if the PO Number or any field value you added field mapping for, is missing in the inbound e-document, or it does not exist in your records or account, an error will be displayed on the E-document audit trail on the inbound E-document record. Also, a vendor bill will not be created.
Adding More Fields in Inbound Template Field Mapping
You can add more fields on transactions created from inbound e-documents. If you want to add Department, Class, or Location fields, you can add the following lines of code in the inbound e-document JSON template field mapping.
"department": "My_department",
"class": "My_class",
"location": "My_location",
For reference, these lines of code are highlighted in the following field mapping block of code, so that you will know where to add it.
<#ftl ns_prefixes={"A":"http://www.unece.org/cefact/namespaces/StandardBusinessDocumentHeader", "D":"urn:oasis:names:specification:ubl:schema:xsd:Invoice-2", "cac":"urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2", "cbc":"urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"}>
{
"tranid": "${XML["A:StandardBusinessDocument"]["D:Invoice"]["cbc:ID"]}",
"trandate": "${CUSTOM["trandate"]}",
"duedate": "${CUSTOM["duedate"]}",
"createdfrom":"${XML["A:StandardBusinessDocument"]["D:Invoice"]["cac:OrderReference"]["cbc:ID"]}",
"memo": "${XML["A:StandardBusinessDocument"]["D:Invoice"]["cbc:Note"]}",
<#if CUSTOM["currency"]?has_content>
"currency": "${CUSTOM["currency"]}",
</#if>
"department": "My_department",
"class": "My_class",
"location": "My_location",
"item": [
<#assign index=0>
<#assign taxcodeString="taxcode_">
<#list XML["A:StandardBusinessDocument"]["D:Invoice"]["cac:InvoiceLine"] as item>
{
"vendorcode": "${item["cac:Item"]["cbc:Name"]}",
"vendorname": "${item["cac:Item"]["cbc:Name"]}",
"quantity": "${item["cbc:InvoicedQuantity"]}",
"rate": "${item["cac:Price"]["cbc:PriceAmount"]}",
"amount":"${item["cbc:LineExtensionAmount"]}",
"taxcode": "${CUSTOM[taxcodeString+index]}",
"description": "${item["cac:Item"]["cbc:Name"]}",
"inventorydetailreq":false
<#assign index++>
}<#if item_has_next>,</#if>
</#list>
]
}
After adding the lines of code, save the template.