- 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
‎02-06-2018 09:56 AM
Great it helped.
Can close this thread by marking it as correct or helpful. This helps alot.
Thanks again

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-30-2018 10:26 PM
Hi Jagadish,
First, I would advice you to run your script in background with dummy variable values. Or else you can able to use log to find the errors of where your script failed to move.
gs.warn();
gs.log(); etc..

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-31-2018 05:04 AM
Hi Jagadish,
Assuming you wrote this script in Catalog task script section:
Please use quotes for US, see below:
var America = 'US';
Try this.
Thanks,