- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2018 08:15 AM
I want to set a default value based on the condition and I tried below script in the default filed of dictionary but it didn't work.
If type = group, set the responsibility to 'ABC'(sys_id=1233456667889) of new record only
Solved! Go to Solution.
- Labels:
-
Incident Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2018 09:11 AM
function onLoad() {
if(g_form.isNewRecord())
{
var type = g_form.getValue('type');
var res = g_form.getValue('responsbility');
if(type == 'group' && res !='')
{
g_form.setValue('responsbility','<sys id that you want to set>');
}
}
}
Try now.. g_form.isNewRecord() will only allow this onload script to run for new record.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2018 08:27 AM
You can achieve this using OnLoad Client script.
Script should be like below:
function onLoad() {
var type = g_form.getValue('type'); //Type should be the backend value for type field
if(type == group)
{
g_form.setValue('responsbility','1233456667889'); //Responsibility should be backend value
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2018 08:31 AM
If a record has responsibility as 'xyz' and user open the form. The above client script will set the value of responsibility to 'abc'

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2018 08:39 AM
Whenever you open the form it will check if type is group or not.
If it is group then it will set the responsibility to mentioned sys_id.
Is this not your requirement ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2018 08:46 AM
No this is not my requirement....
Responsibility field has numerous values but only when creating the NEW record, it should by default populate the "ABC" in responsibility field