- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-30-2020 06:55 PM
I want to auto-assign the cases to the Assignment Group (A) based on the HR Service(B). I created below onLoad client script but it doesn't work:
function onLoad() {
var st = g_form.getValue('hr_service');
if(st == 'B'){
g_form.setValue('assignment_group','A');
}
}
Thank you
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-30-2020 08:30 PM
What do you mean with 'it doesn't work'? What is the expected result? And what is happening when you run above script?
Things to check:
- Any other scripts setting the assignment group on load?
- Is there a reference qualifier on the assignment group field?
- Is the value of hr_service really B?
To check please share following alert results:
function onLoad() {
var st = g_form.getValue('hr_service');
alert('alert 1 result=' + st);
if (st == 'B') {
alert('alert 2 result=' + g_form.getValue('assignment_group'));
g_form.setValue('assignment_group', 'A');
alert('alert 3 result=' + g_form.getValue('assignment_group'));
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-30-2020 08:37 PM
Can you reproduce this in your personal dev instance so that I can look into this issue.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-30-2020 07:48 PM
Create an assignment rule better than client script to do the same
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-30-2020 08:08 PM
The assignment rule didn't work!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-30-2020 08:30 PM
What do you mean with 'it doesn't work'? What is the expected result? And what is happening when you run above script?
Things to check:
- Any other scripts setting the assignment group on load?
- Is there a reference qualifier on the assignment group field?
- Is the value of hr_service really B?
To check please share following alert results:
function onLoad() {
var st = g_form.getValue('hr_service');
alert('alert 1 result=' + st);
if (st == 'B') {
alert('alert 2 result=' + g_form.getValue('assignment_group'));
g_form.setValue('assignment_group', 'A');
alert('alert 3 result=' + g_form.getValue('assignment_group'));
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-30-2020 09:09 PM
I just needed to put the sys ids instead of A and B in the lines below:
if (st == 'B')
g_form.setValue('assignment_group', 'A')
Thank you