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.

Need to populate the free text value to the one of the reference field in the Incident table

vinuth v
Tera Expert

Hi All,

 

I am working on the Record producer form, My requirement is on the form level I have one field called "Please provide the ADO/Change number associated with the previous change." it is a single line text field and I wanted to updated this field value to the "Caused by Change" OOB field in the incident table and it is a reference field and referring to change_request table.

 

Note : 

Please provide the ADO/Change number associated with the previous change backend value is ado_change

Caused by Change backend value is caused_by

 

I tried like this in the Record Producer script,

vinuthv_0-1713522838134.png

 

In the background script I tried like below,

var gr=new GlideRecord("incident");
gr.addQuery('number''INC0010003');
gr.query();
if(gr.next())
{
    gr.caused_by="chg3344";
    gr.update();
}
 
But It is not working please any one suggest me,
 
Thanks,
Vinuth

 

6 REPLIES 6

NitishKumar0012
Tera Guru
var gr=new GlideRecord("change_request");
gr.addQuery('number', producer.ado_change);
gr.query();
if(gr.next())
{
    current.caused_by=gr.sys_id;
}

Hi @NitishKumar0012 

 

I tried above one but it is not working,

vinuthv_0-1713524809492.png