explain a BR logic

mathewirene
Tera Contributor

can someone please help me decode the use of this BR. Attached in screenshot

when : Before , insert - yes, table: incident 

Filter Conditions

origin_table=interaction^assigned_toISEMPTY^EQ

Role conditions

itil, sn_incident_write

 

 

condition: !current.origin_id.nil()

(function executeRule(current, previous /*null when async*/) {
    var interactionId = current.origin_id;
    var gr = new GlideRecord("interaction");
    if (gr.get(interactionId))
        current.assigned_to = gr.getValue("assigned_to");
})(current, previous);
2 ACCEPTED SOLUTIONS

Sarthak Kashyap
Kilo Sage

Hi @mathewirene ,

 

The Business Rule details you shared it is working on incident table and before insert and when original table is interaction and assigned to field is empty, it will assigns the value of the Assigned to field from the Interaction table to the Assigned to field on the Incident table.

 

Please mark my answer as correct and helpful if this works for you.

Thanks and regards,
Sarthak

View solution in original post

Ankur Bawiskar
Tera Patron
Tera Patron

@mathewirene 

the BR is simply checking if the incident is getting created from Interaction

If yes then it picks the assigned to of interaction is assigning to INC

Script is correct.

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

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

View solution in original post

3 REPLIES 3

Voona Rohila
Mega Patron
Mega Patron

Hi @mathewirene 

The code looks good,Can you explain in detail of the issue? 

 

Keep a log inside your BR to see if origin id & Interaction assigned to has a value?

 


Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP

Sarthak Kashyap
Kilo Sage

Hi @mathewirene ,

 

The Business Rule details you shared it is working on incident table and before insert and when original table is interaction and assigned to field is empty, it will assigns the value of the Assigned to field from the Interaction table to the Assigned to field on the Incident table.

 

Please mark my answer as correct and helpful if this works for you.

Thanks and regards,
Sarthak

Ankur Bawiskar
Tera Patron
Tera Patron

@mathewirene 

the BR is simply checking if the incident is getting created from Interaction

If yes then it picks the assigned to of interaction is assigning to INC

Script is correct.

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

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