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 the Interaction number into the Custom Reference filed in Incident form

rajesh29
Tera Expert

Hi Everyone,

 

I have Created reference field called Parent Interaction(reference table: Interaction) on Incident form. here my question is how to get the associated Interaction Number on this field? Could you please help me on this.

rajesh29_0-1694019753890.png

 

Thanks,

Rajesh Bandila.

1 ACCEPTED SOLUTION

Hi @rajesh29 

Create a BR on the interaction_related_record table, and set the value for task

AmanKumarS_0-1694076648523.png

 

(function executeRule(current, previous /*null when async*/) {

    var grInc = new GlideRecord("incident");
    if(grInc.get(current.getValue("task")){
        grInc.setValue("u_parent_interaction", current.getValue("interaction"));//check field name
        grInc.update();
    }

})(current, previous);
 
Best Regards
Aman Kumar

View solution in original post

4 REPLIES 4

Aman Kumar S
Kilo Patron

Hi @rajesh29 

You can just one line in "create incident" UI action on Interaction table:

inc.u_parent_interaction = current.getUniqueValue();// just validate your variable name
 
as below:
AmanKumarS_0-1694021556302.png

 

Best Regards
Aman Kumar

Thank @Aman Kumar S 

 

It's working as expected when I create new Incident. But I need to get the interaction number when ever interaction is associated with any Existing Incident.

Could you please help me on this?

Thanks,
Rajesh Bandila.

Hi @rajesh29 

Create a BR on the interaction_related_record table, and set the value for task

AmanKumarS_0-1694076648523.png

 

(function executeRule(current, previous /*null when async*/) {

    var grInc = new GlideRecord("incident");
    if(grInc.get(current.getValue("task")){
        grInc.setValue("u_parent_interaction", current.getValue("interaction"));//check field name
        grInc.update();
    }

})(current, previous);
 
Best Regards
Aman Kumar

Thanks @Aman Kumar S 

 

It's working perfectly. Thanks a lot!!