- 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 06:52 AM
Hi @Samiksha2
Could you please provide lil more details what exactly is use case?
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 07:06 AM
Hi @Dr Atul G- LNG ,
I have created a string field (CSMText) in Account table.
And there is a catalog item with select variable(Name- CSM). On load of form the value of CSMText should populate as a select box of the logged in user's account.
I have posted on more query related to this.
Thanks,
Sam
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2024 10:44 AM
Hi @Samiksha2
Might be helpful
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0779000
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 11:06 AM
Hi @Dr Atul G- LNG ,
This is to populate current user. How string will populate in select box?
Thanks,
Sam