The hr_ActivitySet API handles lifecycle event activity set cases.

Lifecycle event activity sets represent different stages in the lifecycle event process. You must define when the activity set is triggered, such as immediately upon creation of the lifecycle event case or after the completion of another activity set. Each activity set is associated with a single lifecycle event.

The hr_ActivitySet API requires the HR Lifecycle Events plugin (com.sn_hr_lifecycle_events) and runs in the sn_hr_le namespace.

For additional information, see Understanding Enterprise Onboarding and Transitions.

hr_ActivitySet - hr_ActivitySet()

Instantiates an instance of the hr_ActivitySet class.

Table 1. Parameters
Name Type Description
None

hr_ActivitySet - createLECaseByService(String hrService, Object caseValues)

Creates a lifecycle event case based on a specified HR service.

Table 3. Returns
Type Description
String Sys ID of the created case in the HR Lifecycle Events Cases [sn_hr_le_case] table.

Example

Output includes summary with Operation Table and Row Count columns. Click the link in the row count column adjacent sn_hr_le_case table to view the new case.

var caseValues = {
              'subject_person': '62826bf03710200044e0bfc8bcbe5df1',
              'opened_for': '0e826bf03710200044e0bfc8bcbe5d7c',
              'subject_person_job': 'f8d56900587d3700964f4efae452b3db',
              'location': '25ab9d1d0a0a0bb300537fd25687439d',
              'department': '93b25282c0a8000b0b55c8ab34e2f1e6',
              'subject_person_hr_profile': '330370019f22120047a2d126c42e7012',
              'short_description': 'Short description',
              'state': 10
          };

  var activity = new sn_hr_le.hr_ActivitySet();
  var createCase = new activity.createLECaseByService('4719647c67a60300132a6c3b5685ef16', caseValues);

Output:

...
insert	sn_hr_le_case	1
...

hr_ActivitySet - hasActiveCaseByService(String spUser, String hrService, String jobId)

Checks for a case matching the specified combination of subject person user, HR service, and job.

Table 4. Parameters
Name Type Description
spUser String Sys ID of subject person user in the Users [sys_user] table.
hrService String Sys ID of HR service in the HR Services [sn_hr_core_service] table.
jobId String Sys ID of subject user's job title in the HR Services [sn_hr_core_service] table.
Table 5. Returns
Type Description
Boolean True if matching case exists, false otherwise.

Example

var userId = '62826bf03710200044e0bfc8bcbe5df1'; //Abel Tuter
var hrServiceId = '64fa4c53534222003066a5f4a11c0875'; //Onboarding HR Service
var jobId = '3D62826bf03710200044e0bfc8bcbe5df1'; // Sample Job sys_id for the example

var activity = new sn_hr_le.hr_ActivitySet();

var hasActiveLECase = activity.hasActiveCaseByService(userId, hrServiceId, jobId);

gs.info('User has an active HR case: ' + hasActiveLECase);

Output:

sn_hr_le: User has an active HR case: false