The CreatorCon Call for Content is officially open! Get started here.

incident opent by will populate Assigned To

yardenKrispel
Tera Contributor

Hey! I need help
I want when saving a new incident (new), if the fault is not marked as a call log that would be false (this is a checkbox I created) then to automatically populate the Assign to with whoever created the fault. I tried everything and it doesn't work now I tried client script-onSumbit that its not work!

 

 

yardenKrispel_0-1706452231055.png

 

11 REPLIES 11

Hello @yardenKrispel ,

The script seems fine initially, using the `setValue` method to set the "assigned_to" field to the current user's ID. Yet, there's a minor syntax issue: `gs.getUserID` is a function and requires parentheses for a correct call. The corrected script is as follows:

(function executeRule(current, previous /*null when async*/) {
  gs.addInfoMessage("Business Rule triggered on incident insert.");

  gs.log("Business Rule triggered on incident insert. Current Record ID: " + current.sys_id);

  // Set "assigned_to" to the current user's user ID
  current.setValue("assigned_to", gs.getUserID());
})(current, previous);

 

Let me know your views on this and Mark Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.

 

Thanks,

Aniket

no work...

that is user example 

yardenKrispel_0-1706460641620.png

 

Vishal Birajdar
Giga Sage

Hello @yardenKrispel 

 

Just an query....!!!

Is this a business requirement....?? OR you are doing this practice....??

Because Assigned to is someone who will work on this incident (generally Ops team member) to resolve that issue and Opened by is someone who logged that incident generally it will be end user...

 

 

 

Vishal Birajdar
ServiceNow Developer

I know one thing, and that is that I know nothing.
- Socrates

how do I do it?