Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Decision Table API works in business rule but not in an onChange client script

Rachel55
Mega Guru

Business Rule:

This BR runs fine, but I would like this to run in an onChange client script.

Rachel55_2-1745287123384.png

 

Client Script:

This client script does send the sys id to the script include.

Rachel55_1-1745286925530.png

 

Script Include:

The script include receives the location sys id, but never returns anything.  The alert in the call back function above displays "undefined".

Rachel55_3-1745287409269.png

Can anyone spot what I am doing wrong?

 

 

2 ACCEPTED SOLUTIONS

Chaitanya ILCR
Mega Patron

Hi @Rachel55 ,

it's your callback function on the client script 

since you have used getXMLAnswer you don't have to parse the xml to get the answer

 

Try this

 

function SetAssignedTo(response){

alert(response)

}

 

 

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya

View solution in original post

Ankur Bawiskar
Tera Patron
Tera Patron

@Rachel55 

try to use this syntax

ga.getXMLAnswer(function(answer){
alert(answer);
 });

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

2 REPLIES 2

Chaitanya ILCR
Mega Patron

Hi @Rachel55 ,

it's your callback function on the client script 

since you have used getXMLAnswer you don't have to parse the xml to get the answer

 

Try this

 

function SetAssignedTo(response){

alert(response)

}

 

 

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya

Ankur Bawiskar
Tera Patron
Tera Patron

@Rachel55 

try to use this syntax

ga.getXMLAnswer(function(answer){
alert(answer);
 });

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader