- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-04-2018 03:15 AM
Hi
i want to pass this tow value from script include to client script,
its displaying correct value in the script include but then i get this thought client script its displaying this error ([object XMLHttpRequest])
Script Include :-
if(grp.next()){
asgment.push(grp.getDisplayValue('assignment_group'));
priority.push(grp.getDisplayValue('priority'));
}
var result =[asgment,priority];
return result;
Client Script :-
function CallBack(response){
alert(response);
g_form.setValue('short_description', response);
}
Solved! Go to Solution.
- Labels:
-
Best Practices
-
Team Development

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-04-2018 05:12 AM
Hi Ramesh,
When you return a payload from the server, it must be a string. I HIGHLY recommend using JSON to ensure arrays, or objects, are preserved properly and that commas or other special characters don't get in the way of a split command. Here's an example of how you can return the priority and assignment_group display value as a JSON object, stringify it on the server side and parse it on the client side, then create your short_description based on those two properties. Sorry for the crappy formatting in the community editor.
if(grp.next()){
var myAnswer = {
"assignment_group" : grp.getDisplayValue('assignment_group'),
"priority" : grp.getDisplayValue('priority')
};
}
var result = JSON.stringify(myAnswer);
return result;
Client Script :-
function CallBack(response){
var answer = response.responseXML.documentElement.getAttribute("answer");
var myObj = JSON.parse(answer);
var myString = myObj.assignment_group + ' ' + myObj.priority;
g_form.setValue('short_description', myString);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-04-2018 03:30 AM
Script include returns name value pair (Array type) which you are trying to assign to the Short Description which is a String Type.
Thanks,
Rajesh T
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-04-2018 04:46 AM
Can you put log in the script include for result and see the output.
Try this if you don't see output:
var result = [];
if(grp.next()){
result.push("'"+grp.getDisplayValue('assignment_group')+"'");
result.push("'"+grp.getDisplayValue('priority')+"'");
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-04-2018 05:12 AM
Hi Ramesh,
When you return a payload from the server, it must be a string. I HIGHLY recommend using JSON to ensure arrays, or objects, are preserved properly and that commas or other special characters don't get in the way of a split command. Here's an example of how you can return the priority and assignment_group display value as a JSON object, stringify it on the server side and parse it on the client side, then create your short_description based on those two properties. Sorry for the crappy formatting in the community editor.
if(grp.next()){
var myAnswer = {
"assignment_group" : grp.getDisplayValue('assignment_group'),
"priority" : grp.getDisplayValue('priority')
};
}
var result = JSON.stringify(myAnswer);
return result;
Client Script :-
function CallBack(response){
var answer = response.responseXML.documentElement.getAttribute("answer");
var myObj = JSON.parse(answer);
var myString = myObj.assignment_group + ' ' + myObj.priority;
g_form.setValue('short_description', myString);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-04-2018 07:48 AM
Hi Chuck
Thank you,
its working fine. i did small change. now its working
Script Include :
if(grp.next()){
var myAnswer = {
"assignment_group" : grp.getDisplayValue('assignment_group'),
"priority" : grp.getDisplayValue('priority')
};
var result = JSON.stringify(myAnswer);
gs.info("Test Result" + result);
return result;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-05-2018 04:38 AM
Hi Chuck
Actually i can call the script include in Client Side and its working fine,
I want get the same value in BR, so please tell me how to call the same script include in Business Rule also.
Thanks