- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2023 04:49 AM
Hello experts,
we have a business requirment to auto assign the new case to the the opened by user (supporter -on behalf of the subject person), if the case was raised from case the HR agent workspace (if from service portal - no auto assignment).
any suggestions? if there is an indication for the case source it can be a solution because then I could run a BR for auto assignment after creation.
Thanks.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-24-2023 06:44 AM - edited 08-24-2023 06:45 AM
Alright, here's an easier solution:
- Create a new business rule on the target table, e.g. sn_hr_core_case.
- Configure the BR with Advanced set to true, Before Insert, and add any conditions you want, e.g. HR Service, etc.
- In the Advanced tab, add the following lines of code
- Condition:
gs.action.getGlideURI().toString().includes('api/now/')
- Script:
current.setValue('assigned_to', current.getValue('opened_by'));
- Condition:
- Save the Business Rule
I have tested the above and it works fine for me (Vancouver, but I believe earlier versions should work the same way).
Hope it helps!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2023 06:35 AM
@tpeleg You can create a custom field on the HR Case. This custom field can be populated using a client script for e.g.
function onLoad() {
var view = getView();
if (view == 'workspace'){
g_form.setValue('u_case_source','workspace');
}
}
This way you will be able to identify the case generated through workspace.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2023 07:44 AM
Or skip the custom field entirely, and put this logic in an onsubmit client script to set the assignee field directly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2023 10:17 AM
Hi and thank you @Laszlo Balla & @Sandeep Rajput .
great idea, but i'm working inside the OOTB page (now/hr/agent/case-creation-page). how can I write client script for this page?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-24-2023 06:44 AM - edited 08-24-2023 06:45 AM
Alright, here's an easier solution:
- Create a new business rule on the target table, e.g. sn_hr_core_case.
- Configure the BR with Advanced set to true, Before Insert, and add any conditions you want, e.g. HR Service, etc.
- In the Advanced tab, add the following lines of code
- Condition:
gs.action.getGlideURI().toString().includes('api/now/')
- Script:
current.setValue('assigned_to', current.getValue('opened_by'));
- Condition:
- Save the Business Rule
I have tested the above and it works fine for me (Vancouver, but I believe earlier versions should work the same way).
Hope it helps!