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.

HR Service - HR Task with a task 'collect user input'

Paulina
Tera Contributor

Hi,

 

I'm currently in the process of building an HR Service that involves several tasks.

 

First task is for the 'Subject user': the user must confirm whether the item is approved. If the item is approved, then user needs to provide few specific details. My plan was to create an HR Task to 'Collect user input'. However, I'm having difficulty finding a straightforward way to add the collected input back into the original HR Case.

 

On the other hand, if the item is not approved, the case should be marked as 'Closed incomplete'.

 

Could anyone provide guidance on how to effectively integrate the collected user input into the original HR Case? Any tips or best practices you could share would be greatly appreciated.

 

Thank you so much for your support and assistance.

3 REPLIES 3

Rob Sestito
Mega Sage

Hey @Paulina - 

 

When you are configuring an HR Service, you could change the 'Fulfillment Type' field to Service Activity.

This will then provide you with the Service Activities section at the bottom of the form.

RobSestito_0-1763145355097.png

 

From there you can click on New which will bring you to a Service Activity form. You can select Activity Type as Task --> Then you will get a new field called Child Task Template. From that you can click the magnifying glass, and create a new template:

RobSestito_1-1763145512536.png

RobSestito_2-1763145549816.png

This brings you to the HR Task Template form. Here is where you can create the type of task you want it to be. You can make the HR Task Type as Collect Employee input - 

RobSestito_5-1763145727908.png

 

If you have a template form already created, you would select it as the Employee form field. Otherwise, you can create a new one. OOTB, I happen to have a form called Onboarding Swag Form that will use so that I can show you.

 

So, once the new hr case with your new hr service is selected, and moved into Ready state, it will kick off the Service Activity(s), as you can have multiple tied to one service.

 

When the Service Activity kicks off the tasks, the employee will then have the form on the portal side to fill out, under their tasks.

RobSestito_6-1763145926067.png

 

I hope this helps you with building out your process.

If you need additional clarifications/configuration guidance, please let us know.

 

Thank you!

-Rob

 

 

@Rob Sestito  - thanks for detailed description. I know how to initiate such task. 

I am uncertain how to add collected input to original case.  I would like to make sure that agent has all needed information when processing the case, and not need to go to survey answers in separate module. 

 

Hey @Paulina - 

 

Okay - I thought I was missing something from your original post. Sorry about that!

So, there are a few ways we can grab that info from the Employee Form and add it to the Parent HR Case.

 

You could work it through a Flow or Add Mappings (from the employee form). However, I think those ways would need you to then also create custom fields. For the Add Mappings from the Employee form (as seen below), the mapping is a one-to-one.

RobSestito_0-1763403438265.png

 

Or, you could create a relationship between the tables, with a query script, and then add it as a Related List tab at the bottom of the HR Case Form. I did that to show you how it could look (ignore all the tabs I have done there - that is what Dev instances are for, right? haha)

 

RobSestito_2-1763403613865.png

 

To go this route, navigate to:

  • System Definitions --> Relationships

     

RobSestito_0-1763404282771.png

 

  • Click New in the upper right-hand corner and fill out the form
    • Name (whatever you would like this to be called)
    • Applies to table HR Case [sn_hr_core_case]
    • Queries from table Assessment Instance [asmt_assessment_instance]
    • Script
(function refineQuery(current, parent) {
    var hRCase = parent;
    var assessmentInstance = current;
    var hrCaseId = hRCase.sys_id;
    var grHRTasks = new GlideRecord("sn_hr_core_task");
    grHRTasks.addQuery("parent", hrCaseId).addOrCondition("parent.parent", hrCaseId).addOrCondition("parent.parent.parent", hrCaseId);
    grHRTasks.addQuery("hr_task_type", "collect_Information");
    grHRTasks.addNotNullQuery("survey_instance");
    grHRTasks.query();
    if (!grHRTasks.hasNext())
        current.addQuery("sys_id", "NULL");
    while (grHRTasks.next()) {
        current.addQuery("sys_id", grHRTasks.survey_instance);
    }
})(current, parent);

Once the above is all set, navigate to your HR Case form and configure Related Lists.

Add your new tab and this will now be tied to the case. The agent can then go into that record and see the results.

RobSestito_4-1763403988059.png

 

Thoughts on all of that?