How to create variables associated with a Standard Change request using API

Jeff Welch1
Kilo Contributor

I am trying to use the SN API to work with and create standard changes that have a Variable Set associated with them that stores variables/info about the request. 

I have been able to locate the variables I need from the question_answer table, however, there does not, so far, appear to be  a way to populate those variables using the SN APIs.  I can query the values but cannot populate them.  I tried submitting the variables in json as part of the request to create the CHG but they still do not get populated, even though the CHG is created successfully.  Any thoughts how to create those variables outside of the UI would be appreciated.  Thank you.

6 REPLIES 6

Hitoshi Ozawa
Giga Sage
Giga Sage

Hi Jeff,

Would like explicit information on how Variable Set is associated with a standard change.

From what I understand it uses a record producer to create the change and includes a variable set that requires certain additional values to be added to the chg on creation.  I'm not familiar with exactly how it is set up.  What I am trying to work out is how to programmatically submit the request to create the chg, and include the variables, using the rest API.

Hi Jeff,

The problem is that there isn't any variable set in the Change Request itself but in the Record Producer. There's a variable set in the Record Producer and there's probably a mapping or a Script to create the Change Request.

So the question probably is not about the getting the variable set in the Change Request but about getting the variable set in the Record Producer. As such, information about the Record Producer is necessary to know how to get the variable set data through API. Unfortunately, it seems like you don't have any information about the Record Producer nor how it's creating a Change Request.

suvro
Mega Sage
Mega Sage

Hi Jeff,

Below KB might give you the information you are looking for

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0686272