- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Dear Friends,
We are doing HRSD Integrations and we need to utilize OOB REST API - HR Case Creation for HRSD and their functions like Create Task.
I tried some JSON and it’s keep throwing errors.
Can anyone please share me, correct JSON payload to create HR Cases.
Also, If we would like to write a custom REST APIs to create HR Case then how we can do this.
Thanks,
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
That REST API isn't intended for general use, it's primary purpose is for the create case UI page /sn_hr_core_case_creation.do
I don't imagine SN will provide technical support to use it outside of this use case.
However, you can pass in a JSON object in the following format
{
"table": "sn_hr_core_case",
"fields": {
"opened_for": {
"value": "62826bf03710200044e0bfc8bcbe5df1",
"setAsDisplayValue": false
},
"subject_person": {
"value": "62826bf03710200044e0bfc8bcbe5df1",
"setAsDisplayValue": false
},
"work_notes": {
"value": "sdsds",
"setAsDisplayValue": false
},
"hr_service": {
"value": "6628cde49f331200d9011977677fcf0b"
}
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
The Table API is available across the platform. However, I'd recommend using the Import Set API so you can transform data before it is inserted into a target table. The Table API provides little control on the data quality that is being sent by the external system
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
ServiceNow HRSD: OOB REST API – Create HR Case (+ Create Tasks)
Overview
This guide shows the correct ways to create HR Cases via OOB REST APIs and how to trigger HR Task creation. It includes ready-to-use JSON payloads and cURL examples. Exact field names can vary slightly by release; these examples use the HR Core tables.
Key Tables
- HR Case: sn_hr_core_case
- HR Task: sn_hr_core_task
- HR Service: sn_hr_core_service (referenced by hr_service)
- Subject Person (user linked to case): subject_person → sys_user
Authentication & Roles
- Use an integration user with HR roles (e.g., sn_hr_core.case_writer or sn_hr_core.admin depending on your ACLs).
- Auth: Basic, OAuth, or API key as configured.
- Headers: Content-Type: application/json, Accept: application/json
Approach A (Recommended): Use the Table API to create HR Case
Endpoint:
POST /api/now/table/sn_hr_core_case
Minimum required fields:
- hr_service (sys_id of the HR Service that defines lifecycle/activity sets)
- subject_person (sys_id of the impacted employee)
Common optional fields:
- short_description
- description
- priority
- assigned_to or assignment_group (if your process allows direct assignment)
- u_* custom fields
Example payload (minimal):
{
"hr_service": "7f0c1c03db5a30107f8d4d2f2996191d",
"subject_person": "005a2a04c0a80164007a9b51c1c7e1d3"
}
Example payload (with details):
{
"hr_service": "7f0c1c03db5a30107f8d4d2f2996191d",
"subject_person": "005a2a04c0a80164007a9b51c1c7e1d3",
"short_description": "Laptop stipend request for relocation",
"description": "Employee relocating to Milan requests stipend per policy HR-SVC-017.",
"priority": "3",
"assignment_group": "46d44c08c611227a0183ff3e6c2e6c6f"
}
cURL:
curl -X POST "https://YOUR_INSTANCE.service-now.com/api/now/table/sn_hr_core_case" -H "Content-Type: application/json" -H "Accept: application/json" -u "api.user:password" -d '{
"hr_service":"7f0c1c03db5a30107f8d4d2f2996191d",
"subject_person":"005a2a04c0a80164007a9b51c1c7e1d3",
"short_description":"Laptop stipend request for relocation"
}'
How to auto-create HR Tasks
If your HR Service has Activity Sets / Playbooks configured (HRSD OOB), creating the case with that hr_service typically triggers Business Rules/Flow to create the tasks automatically. Nothing else needed in the payload.
If tasks are not created automatically, verify:
- HR Service (sn_hr_core_service) has Activity Set(s) linked and is Active.
- HRSD Lifecycle plugins are active.
- Any Flow/BR that generates tasks is active and conditions are met (e.g., case state, subtype).
Approach B: Direct HR Task creation (if you must create tasks via API)
Endpoint:
POST /api/now/table/sn_hr_core_task
Required fields:
- parent (sys_id of the sn_hr_core_case just created)
- short_description (and other task fields per your process)
Example payload (HR Task):
{
"parent": "2b7e1a06db0e30107f8d4d2f2996198b",
"short_description": "Collect relocation documents",
"assigned_to": "6f7a2b04c0a80164007a9b51c1c7e2f1"
}
cURL:
curl -X POST "https://YOUR_INSTANCE.service-now.com/api/now/table/sn_hr_core_task" -H "Content-Type: application/json" -H "Accept: application/json" -u "api.user:password" -d '{ "parent":"2b7e1a06db0e30107f8d4d2f2996198b", "short_description":"Collect relocation documents" }'
Approach C: OOB HR Case API (if enabled in your release)
Some releases include an OOB HR Case API wrapper.
Example endpoint pattern:
POST /api/sn_hr_core/case
Payload (pattern):
{
"service": "7f0c1c03db5a30107f8d4d2f2996191d", // hr_service sys_id
"subject_person": "005a2a04c0a80164007a9b51c1c7e1d3",
"short_description": "HR laptop stipend"
}
If your instance exposes /api/sn_hr_core/case/{sys_id}/tasks, you can post to create default tasks; otherwise rely on the service’s activity sets.
Common Errors & Fixes
- 401/403 Unauthorized: Ensure user has HR roles and API access.
- 400 Bad Request: Missing hr_service or subject_person; or wrong field name.
- 403 Security constraints: HR data is highly restricted—confirm user meets ACLs and HR criteria rules.
- No tasks created: The HR Service has no Activity Sets or the generation Flow/BR is inactive.
- Using opened_for vs subject_person: HRSD cases use subject_person; opened_for is ITSM.
Tips
- Use sysparm_display_value=all on GET responses while testing to see label vs value.
- Confirm required fields: open sn_hr_core_case dictionary to check mandatory fields/attributes.
- Test HR Service manually via HR Agent Workspace to ensure it creates tasks before automating via API.
- For multi-language, keep short_description/description in a base language; localization is handled separately.
Minimal Working Sequence
1) POST /api/now/table/sn_hr_core_case with hr_service + subject_person.
2) Read response.result.sys_id (case id).
3) (Optional) POST HR tasks directly to sn_hr_core_task with parent = case sys_id, unless your HR Service auto-creates tasks.
