Use Javascript to dynamically set Assigned To field same as Opened By field.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2018 01:34 PM
Hi All, I can't seem to find exactly what I'm looking for, or am not thinking about putting the correct things together to get this working.
When a few team members and I want to send an incident back to the originating technician, we typically use templates for the work note and state. However, we manually copy the technician's name from the Opened By field into the Assigned to Field.
It would be beneficial and save some time when re-assigning incidents.
I know we can use something similar to below to get the CURRENT user's ID:
javascript:gs.getUserID()
I tried to string some things together to figure out the best way to assign to the opening tech by creating a template with the criteria of Assigned to is :
javascript:
var opener = [];
var inc = new GlideRecord('incident');
inc.get('opener','Opened By');
opener.push(inc.getValue('Opened By'));
Sadly, the above only shows that I attempted to modify the Assigned to field, but nothing actually shows up.
What would your suggestions for this be?
- Labels:
-
User Interface (UI)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2018 01:43 PM
Did you try below
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2018 01:46 PM
I did not until you just suggested it.
However, I just tried both of those.. neither enters anything into the Assigned To field, but the assigned to field shows that it's been modified (check mark).

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2018 01:49 PM
Can you share screenshot of template?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2018 02:10 PM
Sooo... I don't even know how to explain this one...
Previously, I could enter the above but it would stay red as if it's not accepting the information.
Now when I go in to edit the template, it's showing Assigned to as blank... and when I paste in the same JS again ....
It shows "Brian Null" for the user...
So it sounds like ServiceNow really doesn't want me to use that javascript.
--------------------------------------
--------------------------------------