- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-15-2023 10:37 AM
Hi,
I have a field called 'v_location' - a reference type variable.
Ask is to route the Assignment Group based on the field value of 'v_Location.
If the location value is either A, B or C, then route to Assignment Group 'DNS' also set the short description to 'Validate equipment received'
else if v_location values is NOT A, or B or C, THEN the Assignment group should be routed to the the v_location Local support group & also set the short description to 'Install & Retrieve equipment'
I am trying to add the above code in the Advanced script of the Workflow activity.
Would appreciate any help to have this coded.
Thanks
KS
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-15-2023 10:51 AM
var v_location = current.variables.v_location;
if (v_location == "A" || v_location == "B" || v_location == "C") {
current.assignment_group.setDisplayValue('DNS');
current.short_description = 'Validate equipment received';
}
else {
var locationGr = new GlideRecord('u_local_support_group_table');
locationGr.addQuery('u_location', v_location);
locationGr.query();
if (locationGr.next()) {
current.assignment_group.setDisplayValue(locationGr.u_local_support_group.toString());
current.short_description = 'Install & Retrieve equipment';
}
}
In this code, we first get the value of the 'v_location' variable and then use an 'if' statement to check if it is equal to "A", "B", or "C". If it is, we set the Assignment Group to "DNS" and the short description to "Validate equipment received". If it's not equal to "A", "B", or "C", we query a custom table 'u_local_support_group_table' to find the local support group associated with the 'v_location' value and set the Assignment Group to that group. We also set the short description to "Install & Retrieve equipment".
Note that you'll need to replace 'u_local_support_group_table' with the actual name of your custom table, and 'u_location' and 'u_local_support_group' with the actual names of the columns in that table that store the location and local support group values, respectively.
Please mark my reply as Helpful and/or Accept Solution, if applicable. Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-15-2023 10:54 AM
if you want to do it in workflow you need to code using server side. You can use something like
if(current.v_location == 'A' ||current.v_location== 'B' || current.v_location== 'C'){
current.assignment_group= "sysid of DNS group";
current.short_description='Install & Retrieve equipment.'.
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-15-2023 10:50 AM
You can write a on change client script on "v_location" field. Something like
if(g_form.getValue('v_location') == 'A' ||g_form.getValue('v_location') == 'B' || g_form.getValue('v_location') == 'C'){
g_form.setValue('assignment_group',"sysid of DNS group")
g_form.setValue('short_description,'Install & Retrieve equipment.')
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-15-2023 10:51 AM
var v_location = current.variables.v_location;
if (v_location == "A" || v_location == "B" || v_location == "C") {
current.assignment_group.setDisplayValue('DNS');
current.short_description = 'Validate equipment received';
}
else {
var locationGr = new GlideRecord('u_local_support_group_table');
locationGr.addQuery('u_location', v_location);
locationGr.query();
if (locationGr.next()) {
current.assignment_group.setDisplayValue(locationGr.u_local_support_group.toString());
current.short_description = 'Install & Retrieve equipment';
}
}
In this code, we first get the value of the 'v_location' variable and then use an 'if' statement to check if it is equal to "A", "B", or "C". If it is, we set the Assignment Group to "DNS" and the short description to "Validate equipment received". If it's not equal to "A", "B", or "C", we query a custom table 'u_local_support_group_table' to find the local support group associated with the 'v_location' value and set the Assignment Group to that group. We also set the short description to "Install & Retrieve equipment".
Note that you'll need to replace 'u_local_support_group_table' with the actual name of your custom table, and 'u_location' and 'u_local_support_group' with the actual names of the columns in that table that store the location and local support group values, respectively.
Please mark my reply as Helpful and/or Accept Solution, if applicable. Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-15-2023 10:54 AM
if you want to do it in workflow you need to code using server side. You can use something like
if(current.v_location == 'A' ||current.v_location== 'B' || current.v_location== 'C'){
current.assignment_group= "sysid of DNS group";
current.short_description='Install & Retrieve equipment.'.
}