If you want to use a template that has more elements in addition to those in the standard
output template, create a static output template. This function enables you to create a template
that includes all of the elements in the standard output template plus any new ones you add.
About this task
For example, you may need to add UI fields for any database columns you have added. Note that if
you use this function, you cannot remove any elements that exist in the standard template.
To
define and deploy a static template:
Procedure
- Copy the standard output template for the API that you
want to modify from the INSTALL_DIR/repository/xapi/template/merged/api/FileName.xml
file to INSTALL_DIR/extensions/global/template/FileName[.DocType].xml.
- Keep the file name of your new template the same as the standard
template.
The name of the output template corresponds with the
name of the API or event associated with it. For example, the getOrderDetails()
API takes the output template file getOrderDetails.xml.
- If the template references a document type, include the document
type code in the filename.
For example, to create an output template
for the getOrderDetails() API for an Order (0001) document type, the
name of the template XML is getOrderDetails.0001.xml.
- Modify the copied template in the /extensions/global/template/api/
directory as required, keeping in mind the best practices for creating
custom output XML templates.
Note: You
may add any elements you wish, but you cannot remove any of the elements
present in the standard output template.
- Call the API as typical and it automatically picks up the
custom output template from the directory containing the custom templates.