Invoke ReST API using "Catalog Client Scripts"

appportal
Kilo Contributor

Hi Team,

We are looking for some documentation related to ServiceNow which can help us implement a new feature in integration with ServiceNow.

The feature needs ServiceNow to talk to ReST APIs exposed by us, during Service Catalog checkout, based on user inputs.

For e.g., if the requester chooses a machine name and a user name during the checkout process of a service catalog, as the requester enters the user name, we should be able to populate a list box (in ServiceNow catalog checkout screen) with the available roles for that user.

The available roles should be fetched using a ReST API call, which should be invoked once the user name is entered.

I found that we could use "catalog client scripts", so that we can write scripts to execute during the events like onChange(), but couldn't find a way to invoke any API using this or GlideAJAX.

Can you please guide us on how to move forward with this or suggest which documentation to follow?

Thanks,

Satheesh

1 ACCEPTED SOLUTION

Hi Satheesh,



Variable sets all you to associate a variable, set of variables, client scripts, or ui policies to more than one catalog item, so you should be able to apply this to some items, but not all.



You can grab the value from a variable in a client script by using g_form.getValue('variablename');


View solution in original post

3 REPLIES 3

srinivasthelu
Tera Guru

Client Script + GlideAjax+ Script Include+ REST MessageV2 should do the job.



Please check below link.




http://wiki.servicenow.com/index.php?title=RESTMessageV2_API


Hi,


Thanks for the reply Srinivas.



I have the above said requirement to be implemented for some selected service catalogs, not all of them.


I was thinking of using the "Variable Sets" for this, but not sure it would help me.


I couldn't find a way to get the value entered for a variable during service catalog checkout.


I have to load the next variable based on the value entered for the first variable.


Is this possible?


Do I have to go for a UI Page? If yes, then how do I configure the UI Page to show up during checkout of some specific service catalogs?



Help is much appreciated.



Thanks,


Satheesh.


Hi Satheesh,



Variable sets all you to associate a variable, set of variables, client scripts, or ui policies to more than one catalog item, so you should be able to apply this to some items, but not all.



You can grab the value from a variable in a client script by using g_form.getValue('variablename');