Populate search box in HR Agent Workspace "Create HR Case" via url parameters

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2023 04:12 PM
In ITSM Agent Workspace, I can navigate to a url such as:
/now/workspace/agent/new_record/interaction/2/params/query/type%3Dphone
to automatically populate the type field with 'phone' or any other field on the form.
In HR Agent Workspace, I would like to do the same thing in the create_case (sn_hr_core_case_creation.do) UI Page that the agent is presented with upon opening a new case.
Similar to /now/workspace/hr/new_record/sn_hr_core_case/8/params/query/sysparm_profile%3DBrian
I see this functionality is availble through the UI on the HR profile 'Create a New Case' /sys_ui_action.do?sys_id=997bc7463bf22200705d86a734efc44b
but I cannot replicate this functionality in the HR Agent Workspace.
Any thoughts?
- Labels:
-
Human Resources Service Delivery
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2023 08:57 PM
HI @brianbeauchamp ,
I trust you are doing great.
Certainly! To achieve a similar functionality in the HR Agent Workspace, you can use the "sn_ws" module in ServiceNow to make a client-side script that populates the desired field on the create_case UI Page.
function populateFieldInHRWorkspace() {
// Get the URL parameters
var params = new URLSearchParams(window.location.search);
// Get the desired field value from the URL parameter
var fieldValue = params.get('sysparm_profile');
// Populate the field on the form
if (fieldValue) {
// Replace 'field_name' with the actual field name on the form
g_form.setValue('field_name', fieldValue);
}
}
// Call the function when the HR Agent Workspace UI Page loads
addLoadEvent(populateFieldInHRWorkspace);
Was this answer helpful?
Please consider marking it correct or helpful.
Your feedback helps us improve!
Thank you!
Regards,
Amit Gujrathi

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2023 05:40 AM
Thanks @Amit Gujarathi . That makes sense but I'm not seeing how I can get my duplicated UI Page to be called when a new HR case is created using the + button in the HR Agent Workspace.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-14-2023 05:26 AM
Hi @Amit Gujarathi ,
This code will be written after the OOTB code present in the workspace section of UI definition, right?
Thanks,
Anu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2023 02:41 AM
Hi @brianbeauchamp : were you able to get this done, even i have similar requirement.
please let me know if you found the solution.