
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2023 05:14 AM
Hi Team,
On sending data from script include using JSON.stringify(arr),we are getting message as [{}] ,we are only sending single value for a scenario.
But when we print the value before JSON.stringify , we do get the proper message in gs.info() as "Carrier" .This value is not getting sent using stringify
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2023 05:52 AM
Hello @Community Alums
use :-
JSON.stringify(arr.toString());
Plz Mark my Solution as Accept, if you find it Helpful.
Regards,
Samaksh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2023 06:39 AM
var fixedByChoice = JSON.parse(answer);
var nameArr = fixedByChoice.split(','); // add these line after above one.
for(var i=0; i<namesArr.length;i++){ // replace your for loop with mine
// ur code
}
Plz Mark my Solution as Accept, if you find it Helpful.
Regards,
Samaksh

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2023 05:16 AM
Hello @Community Alums
It would be helpful if you can post the script you are using.
Thank you,
Ali
Thank you,
Ali
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2023 05:52 AM
Hello @Community Alums
use :-
JSON.stringify(arr.toString());
Plz Mark my Solution as Accept, if you find it Helpful.
Regards,
Samaksh

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2023 06:20 AM
@Samaksh Wani .Now its showing the proper message in alert(answer) as "Carrier" but when we do addOption. We get as below:
Please see my script as below:
if(newValue == 'TPx'){
var caseType = g_form.getValue('u_new_case_type');
var ga = new GlideAjax('CarrierCaseFixedByOptions');
ga.addParam('sysparm_name', 'fixedbyChoices');
ga.addParam('sysparm_owner', newValue);
ga.addParam('sysparm_casetype', caseType);
ga.getXML(function(response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
alert(answer);
var fixedbyChoice = JSON.parse(answer);
//g_form.addOption('u_fixed_by', fixedbyChoice.fixedbyValue, fixedbyChoice.fixedbyLabel);
g_form.clearOptions('u_fixed_by');
g_form.addOption('u_fixed_by', '', '--None--');
for (var i = 0; i < fixedbyChoice.length; i++) {
//g_form.addOption('u_fixed_by', answer[i], answer[i]);
g_form.addOption('u_fixed_by', fixedbyChoice[i].toString(), fixedbyChoice[i].toString());
}
});

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2023 06:26 AM
can you post Script Include script as well here?
Thank you,
Ali