- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-30-2018 10:21 PM
Hello Team,
I have a catalog item created. In the item description, I have created a workflow and attached to this particular catalog item.
Now, In the workflow, I have written a script to assign the task to particular assignment group based on the region populated on the task form.
Please note: Field 'Region' is one of the field on the task form.
Below is the code I have written, I'm not able to track the error in the code. Please help.
var America = US;
var reqForReg = current.request.u_region;
if(reqForReg==America)
{
task.assignment_group = 'Global Communications';
}
else {
task.assignment_group = 'Regional Communications';
}
Thanks
Jagadish
Solved! Go to Solution.
- Labels:
-
Service Catalog
-
Workflow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-06-2018 04:12 AM
Hi Ashutosh,
I did go through the logs to find the bug, so that I can fix it. But it was difficult to read the logs and trace the error at right place.
So, I used the getDisplayValue() to avoid conflicts and it worked for me
I had to fumble as I'm new to writing scripts.
var america='US';
var region = current.task.u_region.getDisplayValue();
if (america==region) {
task.assignment_group.setDisplayValue('Global Communications');
}
else {
task.assignment_group.setDisplayValue('Regional Communications');
}
Thanks
Jagadish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-30-2018 10:24 PM
Hi Jagdish,
Region field is on the sc_task table or sc_request table because as per your script, it looks to be on request table.
Please make sure you are referencing the right table.
var reqForReg = current.request.u_region;
Thanks
Gaurav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-05-2018 01:49 AM
Hi Gaurav,
Thanks for the reply.
I'm pointing to the task table and made the required change.
Even then, the script is not working. I also used 'US' single quotes as suggested by @Ashutosh Munot but nothing worked so far.
Are you seeing any other bug in my code ?
Script:
var America = 'US' ;
var reqForReg = current.task.u_region;
if(reqForReg==America)
{
task.assignment_group = 'Global Communications';
}
else {
task.assignment_group = 'Regional Communications';
}
Please note that both Global Communications and Regional Communications already exists in my groups list.
Thanks
Jagadish

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-05-2018 05:03 AM
Hi Jagadish,
var America = 'US' ;
var reqForReg = current.task.u_region; // Also which type of field this is? Choice or reference and what value comes in this check as per below:
gs.log(reqForReg);
if(reqForReg==America)
{
task.assignment_group = 'As assignment group is reference field, here it should be sys id of group';
}
else {
task.assignment_group = 'As assignment group is reference field, here it should be sys id of group';
}
Thanks,
Please mark Helpful or Correct
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-06-2018 04:12 AM
Hi Ashutosh,
I did go through the logs to find the bug, so that I can fix it. But it was difficult to read the logs and trace the error at right place.
So, I used the getDisplayValue() to avoid conflicts and it worked for me
I had to fumble as I'm new to writing scripts.
var america='US';
var region = current.task.u_region.getDisplayValue();
if (america==region) {
task.assignment_group.setDisplayValue('Global Communications');
}
else {
task.assignment_group.setDisplayValue('Regional Communications');
}
Thanks
Jagadish