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.

Get variable meta data in RecordProducer

Eckhard
Tera Contributor

Dear ServiceNow community,

I have a record producer that creates a record in the change_request table.
This is working fine.

In the record producer I have 3 variables

varSubnet = Reference pointing to table cmdb_ci_ip_network
varSwitch = ListCollector pointing to table cmdb_ci_ip_switch
varLocation = Reference pointing to cmn_location


What I want to achieve is, that a server script loops through the variables and
if the variable is of type Reference or ListCollector and
the related tables are in the hierarchy of cmdb_ci table,
then I want to link this CIs to the change request (Affected CI --> table task_ci).

As a result:
- No location should be linked in table task_ci
- One or more switches should be linked in table task_ci
- One IP Subnet CI should be linked in table task_ci

I know that in table question_answer, there are the variable values from the record_producer stored.
And I also can capture the variable type from there e.g.: Reference - this is great.
But I do not know how I could capture the "referenced" table e.g.: cmdb_ci_ip_switch, which is in the hierarchy of cmdb_ci.

 

We have some similar script in the RITM envrionment (without record producer), where we check the table sc_item_option_mtom
where we can navigate via dot-walking to the referenced table / table hierarchy (sc_item_option.item_option_new.referenceIN + hierarchy).

But in the question_answer table I do not see such a possibility.

 

Do you have any ideas?

Many thanks
Best regards
Eckhard

0 REPLIES 0