Variables values are not populating on the catalog item. But those are auto populating on the portal end.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-18-2019 07:52 AM
Hi All i have a catalog item which has 7 varibles and based on one variable(Lookup select Box) type field other two fields should auto populate Category(select box) and SubCategory(select box). in portal end it is working fine but it is not showing variable values auto populate on the catalog Try It.
Please find the below screen shot for portal end.
find the below screen shot for backend.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-18-2019 08:11 AM
Allen please find the below screen shot. And please suggest to get its work.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-18-2019 08:22 AM
Can you show script?
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-18-2019 08:35 AM
Hi ALlen,
Please find the both client script and script include
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var gd = new GlideAjax('GetCategorySubCatTorchmark');
gd.addParam('sysparm_name', 'getRecordDetails');
gd.addParam('selectedService', g_form.getDisplayValue('service'));
gd.getXML(gdXML);
}
function gdXML(response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
console.log(answer);
//g_form.setValue('category',answer.split(';')[0]);
//g_form.setValue('subcategory',answer.split(';')[1]);
//g_form.setValue('assigned_group',answer.split(';')[2]);
g_form.clearOptions('category'); g_form.clearOptions('subcategory');
//g_form.clearOptions('assigned_group');
var GetCat = [];var GetSubCat = [];var GetAssignmentGroup = [];
GetCat=answer.split(':')[0];
GetSubCat=answer.split(':')[1];
GetAssignmentGroup=answer.split(':')[2];
alert(GetAssignmentGroup);
for(var i=0;i<GetCat.split(',').length;i++){
console.log('GetCat--'+GetCat.split(',')[i]);
g_form.addOption('category', GetCat.split(',')[i], GetCat.split(',')[i], i);
}
for(var i1=0;i1<GetSubCat.split(',').length;i1++){
console.log('GetSubCat--'+GetSubCat.split(',')[i1]);
g_form.addOption('subcategory', GetSubCat.split(',')[i1], GetSubCat.split(',')[i1], i1);
}
for(var i2=0;i2<GetAssignmentGroup.split(',').length;i2++){
console.log('GetAssignmentGroup--'+GetAssignmentGroup.split(',')[i2]);
// g_form.setValue('assigned_group', GetAssignmentGroup.split(',')[i2], GetAssignmentGroup.split(',')[i2], i2);
g_form.setValue('assigned_group',GetAssignmentGroup.split(',')[i2]);
}
//var array = answer.split(",");
//for(var g=0; g<array.length; g++) {
//if(g==2)
// g_form.setValue('assigned_group', array[g]);
//}
}
Script include for Torchmark catalog item@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
var GetCategorySubCatTorchmark = Class.create();
GetCategorySubCatTorchmark.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getRecordDetails: function() {
var selectedService = this.getParameter('selectedService');
var gr = new GlideRecord('u_service_categories_lookup');
gr.addQuery('u_service',selectedService);
gr.query();
var cat = [];
var subCat = [];
var assignmentgrp = [];
gs.info('GetCategorySubCatTorchmark---->'+gr.getRowCount());
var count=0;
while(gr.next()){
cat.push(gr.getValue('u_category'));
gs.log("checking torchmark Category"+cat);
subCat.push(gr.getValue('u_subcategory'));
gs.log("checking torchmark Sub category"+subCat);
assignmentgrp.push(gr.getValue('u_assignment_group'));
gs.log("checking torchmark assignment group"+assignmentgrp);
gs.info(count+'---GetCategorySubCatTorchmark inside'+gr.getValue('u_category'));
gs.info(count+'---GetCategorySubCatTorchmark inside'+gr.getValue('u_subcategory'));
gs.info(count+'---GetCategorySubCatTorchmark inside'+gr.getValue('u_assignment_group'));
}
return cat+':'+subCat+':'+assignmentgrp;
},
type: 'GetCategorySubCatTorchmark'