Client script to Assign Group automatically
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-16-2017 08:26 AM
Hi community
I want to auto-assign automatically the Assignment Group(Hardware Group) based on the Business Service( hardware) that is selected when a user submit a new incident from the Service Portal
I have another Business Service( software) that when a Incident is submitted, they are assigned automatically to "Software Group", it works fine, but I don't know which script handles this.
So, I created this Client Script I found in the community, but something keeps setting all Incidents to "Software Group", I don't know if I am doing something wrong.
function onSubmit() {
//Type appropriate comment here, and begin script below
var bs= g_form.getReference('Hardware', setAssignmentgroup);
function setAssignmentgroup() {
if (bs)
g_form.setValue('Hardware group', bs.assignment_group);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-16-2017 08:46 AM
Hi Lex,
Instead of On-Submit, use the On-Change client script
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
var bs= g_form.getReference('business_service', setAssignmentgroup); // Here it is not hardware.. you have to give the field name
function setAssignmentgroup() {
if (bs)
g_form.setValue('assignment_group', bs.assignment_group); // hardware is value not field so I am replacing the value with field name
}
}
}
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-16-2017 09:36 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-16-2017 05:25 PM
thanks for your help, I tried this script with no luck. Can you share the code, not a screen shot?
thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-17-2017 07:03 AM
Hi Lex,
You need to replace your sysids in the code provided and this is the onchange script on the business service field. Please try and let me know
Thanks,
Rashmi