How to access the record producer variable

ramesh_r
Mega Sage

Hi All,

I have created the record producer and i selected the target table as "remediation_rule" and once I submitted the record procedure the record is getting created in the "remediation_rule" table. and i am trying to get the variable value using the below script but it's not working as expected

Variable will access only Incident change table like that ..? becase the same log working in those table

 

var gr = new GlideRecord('remediation_rule');
gr.addQuery('sys_id', 'ae4d693a2fdf011009d159ab2799b693');
gr.query();
if(gr.next()){
var name = gr.variables.test;

gs.info(name);

}

1 ACCEPTED SOLUTION

Can you check if there is an entry in question_answer table once for the submitted record with required values.

View solution in original post

13 REPLIES 13

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

where are you writing the above script?

the syntax is fine

Are you checking correct variable name? what is the variable type?

Regards
Ankur

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

Jaspal Singh
Mega Patron
Mega Patron

Above should work.

Are you sure

gr.addQuery('sys_id', 'ae4d693a2fdf011009d159ab2799b693');

value being passed as sys_id value is correct.

 

Damini Sheth
Tera Contributor

Record Producer is used to create task based records from service catalog. If you want to access record producer variables then table should be extending from 'task' table . remediation_rule is not extending task table that's why your script is not working as expected.

OM2
ServiceNow Employee
ServiceNow Employee

Did you get the answer Ramesh? I am also facing same issue. If you can let me know, will be helpful.