Including extended attributes in the API template

You can include extended attributes in the API template; however, you must ensure that they are saved in the correct place and in the correct format.

The extended attributes appear as a separate <Extn> element under the primary element.

For example, in the default output XML template of the getItemDetails() API, the Item attributes have the following structure:

<?xml version="1.0" encoding="UTF-8"?>
 <Item .. Item attributes >
    <PrimaryInformation .... PrimaryInformation attributes />
    <ItemServiceSkillList .. ItemServiceSkillList attributes/>
    <ItemAliasList ... ItemAliasList attributes />
   .
   .
 </Item>

After extending the Item header, the getItemDetails() API can output the following XML:

<?xml version="1.0" encoding="UTF-8"?>
 <Item .. Item attributes >
   <PrimaryInformation .... PrimaryInformation attributes />
   <Extn ExtnAltQty="200408201034469490" ..... extnded attributes />
   <YFSPersonInfo .... PersonInfoKey="200408201034469490" ...../>
   <ItemServiceSkillList .. ItemServiceSkillList attributes/>
   <ItemAliasList ... ItemAliasList attributes />
   .
   .
 </Item>
Note: Foreign Key variables for the extended column appear as a PersonInfoKey attribute of the YFSPersonInfo element. The relationship can be validated if the extended column and the PersonInfoKey have the same value.
For example, in the extensions.xml file, the following snippet defines a foreign key relationship.
<Entity TableName="YFS_ITEM">
    <Attributes>
        <Attribute ColumnName="EXTN_PERSON_INFO" DataType="Key" DefaultValue="' '" XMLGroup="Extn" XMLName="YFSPersonInfo"/>
    </Attributes>
    <ForeignKeys>
        <ForeignKey ParentTableName="YFS_PERSON_INFO" XMLName="YFSPersonInfo">
            <Attribute ColumnName="EXTN_PERSON_INFO" ParentColumnName="PERSON_INFO_KEY"/>
        </ForeignKey>
    </ForeignKeys>
</Entity>
Here, EXTN_PERSON_INFO in YFS_ITEM references to the PERSON_INFO_KEY attribute in YFS_PERSON_INFO. If the values match, the output for the getItemDetails API includes both.
<Item ItemID="Item1" ...> 
     ...
     ...
     ...
    <Extn YFSPersonInfo="2025070310105179532"/> 
    <YFSPersonInfo PersonInfoKey="2025070310105179532" .../>
</Item>

The extended attribute is retrieved from the XMLName attribute of the your_filename.xml file that you edited in the previous sections, when extending a standard table. Place your extended templates in the install_dir/extensions/global/template/api directory.

Note: Template files must be encoded in UTF-8 format.