How to set default value of variable in RP to a field value in a table

Popat420
Tera Expert

Hi all,

I have a use case to set the default value of 5 variables in a record producer. the default value should be set to the value of the existing records, which are stored in a table. So basically I need to query a certain table, get the value of field x and use that as default value.

How can I do this?

1 REPLY 1

Brad Bowman
Kilo Patron
Kilo Patron

You'll need to create an onLoad Catalog Client Script that Applies on a Catalog Item view.  This script will use GlideAjax to call a Script Include to do the querying and return the values.  The client script will then set the Catalog Item variables to the values returned by the SI.  Here's an excellent guide if you're not familiar:

https://www.servicenow.com/community/developer-articles/glideajax-example-cheat-sheet-updated/ta-p/2... 

 

Give it a shot and post your scripts using the insert code icon (</>) if you get stuck.