- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2024 08:18 AM
Hi Need help for below client script and Script Include
Client Script:
==============================================================
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var code = g_form.getValue('u_commodity_code');
if (g_scratchpad.isGreenLaneRecord == true) {
var desc = new GlideAjax('FJS_DeclarationGoodsUtilsAjax');
desc.addParam('sysparm_name', 'getCommodityHierarchy');
desc.addParam('sysparam_code', code);
desc.getXML(hierarchyDesc);
}
function hierarchyDesc(response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
g_form.setValue('u_commodity_code_hierarchy', answer);
}
}
===================================================================
Script Include:
getCommodityHierarchy: function() {
var code = this.getParameter("sysparam_code");
var comHierarchy = '';
var goodsDesc = '';
var grCC = new GlideRecord('sn_customerservice_commodity_code');
grCC.addEncodedQuery('u_commodity_code' + code); //u_goods_descriptionSTARTSWITHOther^
grCC.query();
if (grCC.next()) {
var hierDesc = grCC.u_hierarchy_description;
comHierarchy = hierDesc.replace(/[||]+/g, '\n');
goodsDesc = grCC.u_goods_description;
}
var Desc = 'Commodity Code: ' + code + '\n' + 'Commodity Code Description: ' + goodsDesc + '\n' + 'Hierarchy Description: ' + '\n' + comHierarchy;
return Desc;
},
i need to set "u_commodity_code_hierarchy" value with three fields from sn_customerservice_commodity_code table. Please help
Solved! Go to Solution.
- Labels:
-
Customer Service Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2024 10:23 AM
Creating Desc variable in both client script and Business rule caused the issue.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2024 08:29 AM
Hi @Divya Kandula ,
What is the type of this field "u_commodity_code_hierarchy" single line/or/multi line.
Try with return Desc.toString(); in script include and test.
-Thanks,
AshishKM
Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2024 08:43 AM
It is a multi line string
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2024 08:57 AM
return Desc.toString(); dint work
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2024 10:23 AM
Creating Desc variable in both client script and Business rule caused the issue.