- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-20-2016 12:13 PM
When an incident is created, default assignment group should be set as "IT Systems". I was told that the best practice is to create a client script instead of setting the default value in form design.
Can anyone share script (screenshot) and suggestions?
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-20-2016 12:23 PM
Client scripts are subject to the whim of the client browser. I think it is best practice to move as much of the processing as you can to the server. I would not go Client Script here.
I would do the before insert that was suggested above.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-20-2016 12:17 PM
You can set it with client script with g_form.setValue like this
g_form.setValue('variable_name', 'sys_id of group');
Reference: GlideForm (g form) - ServiceNow Wiki

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-20-2016 12:20 PM
Hi Robert,
There's a third argument that needs to be filled in when setting reference fields with g_form.setValue().
g_form.setValue('fieldname', sys_id, displayValue);
Most people forget the third one which causes the client to make a (synchronous) request back to the server which can cause delays.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-20-2016 12:25 PM
never noticed that myself. Great tip

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-20-2016 12:18 PM
Hi Ronald,
I would disagree with whomever told you that a client script is best practice. It's a bit more complex.
The easiest way is from the dictionary (as a default value or dictionary override to the default value).
System Dictionary - ServiceNow Wiki
Dictionary Overrides - ServiceNow Wiki