SetValue using sys_id
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-19-2016 01:19 PM
My client needs the assigned to field to be mandatory for certain users. The issue I am having is the client also needs to assignment group to not show in this same situation. We have the assigned to field as a reference to the assignment group. I tried using the following script in a client script and it is not functioning as I thought it would. The assignment group is showing up false and the assigned to field no longer as the correct options under it.
Here is my script:
function onLoad() {
if (g_user.hasRole('test_user) && !g_user.hasRole('admin_user)){
g_form.setMandatory('assignment_group', false);
g_form.setDisplay('assignment_group', false);
g_form.setValue('assignment_group', '(sys id here', 'display value here');
g_form.setMandatory('assigned_to);
}else{
g_form.setDisplay('assignment_group', true);
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-19-2016 01:22 PM
Try this, there was a syntax error on the highlighted line
function onLoad() {
if (g_user.hasRole('test_user) && !g_user.hasRole('admin_user)){
g_form.setMandatory('assignment_group', false);
g_form.setDisplay('assignment_group', false);
g_form.setValue('assignment_group', '(sys id here', 'display value here');
g_form.setMandatory('assigned_to', true);
}else{
g_form.setDisplay('assignment_group', true);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-19-2016 01:33 PM
Oops let me try that. Bigger issue is really that the assignment group isn't mapping right. I end up with no options to choose from in the assigned to field.
Sent from my iPhone

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-19-2016 01:37 PM
Try
g_form.setValue('assignment_group', 'sys id here'); and let me know if this works.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-19-2016 01:38 PM
Do you have any reference qualifiers on assigned_to field?