- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2020 01:22 PM
Hi all,
My requirement is on “sc_task” form, when record gets created then based on location of “Requested for” I need to set the Assignment group.
I tried to achieve this as below:
Get location of “Requested for” in a field say “u_location_of_requested_for” and then create an Assignment rule ( System policy --> Assignment)
If u_location_of_requested_for = L1 then Assignment Group = AG1
If u_location_of_requested_for = L2 then Assignment Group = AG2
Please guide me, is this correct way to achieve this?
-------------------------------------------------------------------------------------------------------------------------------
I got “Requested for” and Requested for’s location on “sc_task” form. Which are reference fields.
Now I tried to get “Location” in a customize field “u_location_of_requested_for” using client script (on submit) OR Business rule (Insert) but value is not getting set.
Please help ,How can I achieve this?
Thanks,
Priya
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2020 01:25 PM
Why do you need another field?
Create your assignment rule as
CatalogTask.request>requested_for>Location-- is L1-- Assignment group is AG1
Please mark my response as correct and helpful if it helped solved your question.
-Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2020 03:01 PM
Yes. Please mark my responses as correct and helpful as applicable
Please mark my response as correct and helpful if it helped solved your question.
-Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2020 03:17 AM
Thanks prateek.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2020 01:26 PM
Yes, as Prateek said...you'd use assignment rule for this. There's already an OOB solution.
Please mark reply as Helpful, if applicable. Thanks!
Please consider marking 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
04-22-2020 02:07 PM
To further add, you would want to use the applies to section to determine WHEN you want to do this...like...for what catalog tasks. All? Or just maybe some that are from a certain catalog item? You would set that there.
In the script section (you may need to check/turn on the advanced tab)...in the script you would use:
if (current.u_location_of_requested_for == 'sys_id_of_loc_1') {
current.assignment_group = 'sys_id_of_assignment_group_1';
} else if(current.u_location_of_requested_for == 'sys_id_of_loc_2') {
current.assignment_group = 'sys_id_of_assignment_group_2';
}
The above is just an example and assuming that the u_location_of_requested_for is filled in on record creation.
Please consider marking 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
04-22-2020 01:28 PM
Hi Priya,
Try using below business rule that runs before insert/update sc_task table. Since you are using Requested For's information there is not need for it to be stored in additional field.
(function executeRule(current, previous /*null when async*/) {
var getloc=current.request_item.request.requested_for.location;
if(getloc=='sys_id_of_location1')
{
current.assignment_group='sys_id_ofAssignmentgroup1';
}
else if(getloc=='sys_id_of_location2')
{
current.request_item.request.requested_for.location
}
current.update();
})(current, previous);