hr\_ActivitySet - Scoped

concept australia Updated Sep 10, 2026 2 min read hr_ActivitySetAPI.md
Raw file servicenow.com

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.

Name Type Description
None

hr_ActivitySet - createLECaseByService(String hrService, Object caseValues)

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

Name Type Description
hrService String Sys ID of HR service in the HR Services [sn_hr_core_service] table to be assigned to the lifecycle event case.
caseValues Object Key-value pairs containing a value for each case field.
caseValues.subject_person String Sys ID of subject person's name in the User [sys_user] table.
caseValues.opened_for String Sys ID of case opened for subject person in the Users [sys_user] table.
caseValues.subject_person_job String Sys ID of subject person's Business title in the Jobs [sn_hr_core_job] table.
caseValues.location String Sys ID of subject person's location in HR profile in the Locations [cmn_location] table.
caseValues.department String Sys ID of subject person's department in HR profile in the Departments [cmn_department] table.
caseValues.subject_person_hr_profile String Sys ID of subject person's HR profile in the HR Profiles [sn_hr_core_profile] table.
caseValues.short_description String Case description.
caseValues.state Number Number representing uniquely-defined custom case state.
Type Description
String Sys 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.

JavaScript
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:

Text
...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.

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.
Type Description
Boolean True if matching case exists, false otherwise.
JavaScript
var userId = '62826bf03710200044e0bfc8bcbe5df1'; //Abel Tutervar hrServiceId = '64fa4c53534222003066a5f4a11c0875'; //Onboarding HR Servicevar 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:

Text
sn_hr_le: User has an active HR case: false
Search documentation
Search document titles and file paths on the australia branch