Auto -populate "assigned to" field when state is resolved in incident

Younes Elhamss
Tera Contributor

Hey, 

 

I'm a noob and I'm looking for a way to auto populate the assigned to field when the state is set to resolved, and the assigned to field should be the creator of the incident. 

 

Use case:

Person A creates the incident and assigns it to person B to fix something

When B fixes it and clicks resolve, the assigned to should automatically populate A.

 

Is this possible and if so, can you give me a step for step on how to do it? 🙂

 

I hope it makes sense. 

1 ACCEPTED SOLUTION

RaghavSh
Kilo Patron

1. Create a before update business rule on incident table with condition (state changes to resolved).

2. In the script part write:

current.assigned_to = current.caller_id;  // caller_id is the backend name of "affected user" on incident table.

OR

current.assigned_to = current.opened_by;   // if you want to set opened by in assigned to.


Raghav
MVP 2023

View solution in original post

5 REPLIES 5

RaghavSh
Kilo Patron

1. Create a before update business rule on incident table with condition (state changes to resolved).

2. In the script part write:

current.assigned_to = current.caller_id;  // caller_id is the backend name of "affected user" on incident table.

OR

current.assigned_to = current.opened_by;   // if you want to set opened by in assigned to.


Raghav
MVP 2023

@Younes Elhamss were you able to achieve this?


Raghav
MVP 2023

Amazing!! Thank you so much!

Bert_c1
Kilo Patron

Use of a Business Rule is one way.  See examples here:

 

https://[your_instance].service-now.com/sys_script_list.do?sysparm_query=GOTOcollection%3Dincident%5...

 

The one named "Caller Close" is a good starting point to copy.  Modify the 'Condition':

"current.caller_id == gs.getUserID() && (current.incident_state.changesTo(IncidentState.RESOLVED) || current.incident_state.changesTo(IncidentState.CLOSED) || current.incident_state.changesTo(IncidentState.CANCELED))"

and use just "(current.incident_state.changesTo(IncidentState.RESOLVED) "

 

and in the script, use logic:

current.assigned_to = current.caller_id;

 

that one line is enough.