Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

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

brianbeauchamp
Tera Guru

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?

5 REPLIES 5

Amit Gujarathi
Giga Sage
Giga Sage

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



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.

 

 

Community Alums
Not applicable

Hi @Amit Gujarathi ,

 

This code will be written  after the OOTB code present in the workspace section of UI definition, right?

 

Thanks,

Anu

Shambhu K B
Giga Guru

Hi @brianbeauchamp : were you able to get this done, even i have similar requirement.

please let me know if you found the solution.