- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2024 06:45 AM
Hi All,
I have a requirement to show the string values in the select box.
This CSMText field is in account table and these values should be populate in the Catalog item as select box.
Please help in this.
Thanks,
Sam
Solved! Go to Solution.
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2024 09:07 PM
Hi @Dr Atul G- LNG ,
I have done that.
I have written a script include and Onload cline script
Script Include
getCMS: function() {
var answer = [];
var users = this.getParameter('user');
var grs = new GlideRecord('customer_account');
grs.addEncodedQuery('customer=true^sys_id=' + users);
grs.query();
while (grs.next()) {
answer.push(grs.u_csmtext.toString());
}
return answer.join(',');
},
Client Script
var tes = g_form.getValue("u_account");
var gsr = new GlideAjax('get_csm');
gsr.addParam('sysparm_name', 'getCSM');
gsr.addParam('user', tes);
gsr.getXML(test);
function test(response) {
var answers= response.responseXML.documentElement.getAttribute('answer');
var array = answers.split(',');
for (var i = 0; i < array.length; i++) {
g_form.addOption('csm', array[i], array[i]);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2024 11:47 AM
Hi @Samiksha2
really sorry, but I am not this much expert in SN.
@Anurag Tripathi @Jaspal Singh @SanjivMeher
any thoughts.
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2024 12:49 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2024 09:07 PM
Hi @Dr Atul G- LNG ,
I have done that.
I have written a script include and Onload cline script
Script Include
getCMS: function() {
var answer = [];
var users = this.getParameter('user');
var grs = new GlideRecord('customer_account');
grs.addEncodedQuery('customer=true^sys_id=' + users);
grs.query();
while (grs.next()) {
answer.push(grs.u_csmtext.toString());
}
return answer.join(',');
},
Client Script
var tes = g_form.getValue("u_account");
var gsr = new GlideAjax('get_csm');
gsr.addParam('sysparm_name', 'getCSM');
gsr.addParam('user', tes);
gsr.getXML(test);
function test(response) {
var answers= response.responseXML.documentElement.getAttribute('answer');
var array = answers.split(',');
for (var i = 0; i < array.length; i++) {
g_form.addOption('csm', array[i], array[i]);
}
}