Skip to content
Release: Australia · Updated: 2026-03-12 · Official documentation · View source

hr_ActivitySet- Scoped

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.

Parent Topic:Server API reference

hr_ActivitySet - hr_ActivitySet()

Instantiates an instance of the hr_ActivitySet class.

NameTypeDescription
None  

hr_ActivitySet - createLECaseByService(String hrService, Object caseValues)

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

NameTypeDescription
hrServiceStringSys ID of HR service in the HR Services [sn_hr_core_service] table to be assigned to the lifecycle event case.
caseValuesObjectKey-value pairs containing a value for each case field.
caseValues.subject_personStringSys ID of subject person's name in the User [sys_user] table.
caseValues.opened_forStringSys ID of case opened for subject person in the Users [sys_user] table.
caseValues.subject_person_jobStringSys ID of subject person's Business title in the Jobs [sn_hr_core_job] table.
caseValues.locationStringSys ID of subject person's location in HR profile in the Locations [cmn_location] table.
caseValues.departmentStringSys ID of subject person's department in HR profile in the Departments [cmn_department] table.
caseValues.subject_person_hr_profileStringSys ID of subject person's HR profile in the HR Profiles [sn_hr_core_profile] table.
caseValues.short_descriptionStringCase description.
caseValues.stateNumberNumber representing uniquely-defined custom case state.
TypeDescription
StringSys ID of the created case in the HR Lifecycle Events Cases [sn_hr_le_case] table.

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.

NameTypeDescription
spUserStringSys ID of subject person user in the Users [sys_user] table.
hrServiceStringSys ID of HR service in the HR Services [sn_hr_core_service] table.
jobIdStringSys ID of subject user's job title in the HR Services [sn_hr_core_service] table.
TypeDescription
BooleanTrue if matching case exists, false otherwise.
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