This following sample code used to get the Template based on the paremeter that was defined and apply that template for the released product.
//this methods is used to retrieve the Templata data based on the Parameter and returns the container of the templateData that will be used in apply template functionality.
private container getTemplateData()
{
SysRecordTemplateTable templateTable;
SysRecordTmpTemplate tmp;
container dataContainer,RecordTmplateData;
ParameterLocationTable parameterLocation;
int i;
;
parameterLocation = ParameterLocationTable ::find("TestLocation");
sysRecordTmpTemplate=null;
if( parameterLocation )
{
select templateTable where templateTable.table==tableNum(inventTable);
dataContainer=templateTable.Data;
for (i=conlen(dataContainer); i; i--)
{
[tmp.Description, tmp.DefaultRecord, tmp.Data, tmp.Details] = conpeek(dataContainer, i);
if(tmp.Description== parameterLocation .ItemTemplate)
{
tmp.OrgDescription=tmp.Description;
tmp.insert();
RecordTmplateData=tmp.data;
}
}
}
return RecordTmplateData;
}
// apply the Template for the released Product to the company
private void applyTemplate()
{
EcoResProductTemplateApplyManagerUtils utils;
InventTable inventTable;
container recordTmpValues;
// if Product is released to the company
if (releaseProductToCompany)
{
inventTable = InventTable::Find("Item1");
recordTmpValues=this.getTemplateData(_changeOrderProduct);
utils = EcoResProductTemplateApplyManagerUtils::newDefault();
utils.applyTemplate(
recordTmpValues,
inventTable.ItemId);
}
}