- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2023 03:47 AM
I am calling a script include from my onChange Catalog Client Script and it is returning [object Object]. I need to bring back 3 items of information from the script include to populate my catalog form. I tried following the logic in this post
OnChange script:
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2023 04:28 AM
Where exactly are you getting this object object, are the field values getting set with the code you have written?
1 - Once do alert( " answer " + JSON.stringify(answer));
2- alert( " cat clie score " + score); --- this will not work, answer.score will work.
3- Also, in Script Include,make this change. for this var criticality = grCVE.getDisplayValue('normalized_severity'); => cve.criticality = grCVE.getDisplayValue('normalized_severity');

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2023 04:42 AM
Hi,
Update your function "getData" in client script like below:
function getData(response){
var answer = response.responseXML.documentElement.getAttribute('answer');
// check if answer has been set correctcly
alert( " answer : " + answer);
// parse the answer to an object
answer = JSON.parse(answer);
if (typeof answer != 'undefined') {
if(answer.isValid == -1){
alert( " cat clie score " + score);
g_form.setValue('primary_on_cisa_exploited_list_yes_no',answer.exploit);
g_form.setValue('primary_cve_or_cwe_score',answer.score);
g_form.setValue('primary_criticality_level',answer.criticality);
}
}
}
Thanks
Anil Lande
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2023 04:28 AM
Where exactly are you getting this object object, are the field values getting set with the code you have written?
1 - Once do alert( " answer " + JSON.stringify(answer));
2- alert( " cat clie score " + score); --- this will not work, answer.score will work.
3- Also, in Script Include,make this change. for this var criticality = grCVE.getDisplayValue('normalized_severity'); => cve.criticality = grCVE.getDisplayValue('normalized_severity');

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2023 04:42 AM
Hi,
Update your function "getData" in client script like below:
function getData(response){
var answer = response.responseXML.documentElement.getAttribute('answer');
// check if answer has been set correctcly
alert( " answer : " + answer);
// parse the answer to an object
answer = JSON.parse(answer);
if (typeof answer != 'undefined') {
if(answer.isValid == -1){
alert( " cat clie score " + score);
g_form.setValue('primary_on_cisa_exploited_list_yes_no',answer.exploit);
g_form.setValue('primary_cve_or_cwe_score',answer.score);
g_form.setValue('primary_criticality_level',answer.criticality);
}
}
}
Thanks
Anil Lande
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2023 05:56 AM
These both helped me and it works now!!! Thank you both!!!