Fetch 'Template values' from sys_template table and store the values in catalog item fields.

Akanksha Rawoo1
Tera Contributor

My Requirement is I have a field called 'Select Template' on a catalog item which is reference field to sys_template table. When I select any template the template values should be auto populated in catalog item fields on catalog form.

i wrote below catalog client script:

function onChange(control, oldValue, newValue, isLoading) {
if(isLoading || newValue == ''){
return;
}
var template = g_form.getValue('Template');
if(template != '')
//Apply the selected template
 applyTemplate(template);

}

But this is not working as expected. Since the template values are stored as XML attached in the screenshot. I want to extract the values from template values and split them separately to populate the values in catalog item fields.

Finally I want to populate catalog item fields whenever I select a template.

Please can anyone help me out to write catalog client script?

5 REPLIES 5

Akanksha Rawoo1
Tera Contributor

Can we use Script Include and Catalog client script for this setup.