How to return value to getXML function in client script

Tomi Corigliano
Kilo Sage

Hello,

 

I'm calling a script include in my catalog client script through GlideAjax, which works fine. Nevertheless, I can't find a way to return the value to the main function.

 

How is this possible? Preferably with an example.

 

Thanks in advance for your reply.

1 ACCEPTED SOLUTION

@Tomi Corigliano 

you can show field message of type error so it won't allow submitting the form.

So unless and until the user selects correct date they cannot submit it

When the validation fails show field message of type error; if validation is fine clear the message

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

View solution in original post

10 REPLIES 10

newhand
Mega Sage

@Tomi Corigliano 

How about moving the logic you want to run after the GlideAjax in your main function to the callback function?

 

Please mark my answer as correct and helpful based on Impact.

Sandeep Rajput
Tera Patron
Tera Patron

@Tomi Corigliano You can use getXMLWait() if you do not wish to use a callback function, please be informed that getXMLWait() will only work on the platform view and will not work on the Service Portal.

Thank you for your reply. I need it in the Service Portal. So that's unfortunately not an option.

Ankur Bawiskar
Tera Patron
Tera Patron

@Tomi Corigliano 

Can you share your complete scripts and also the screenshots?

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