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.

HRSD OOB REST APIs to Create HR Case

_Samay
Tera Expert

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,

1 ACCEPTED SOLUTION

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"
    }
  }
}

View solution in original post

6 REPLIES 6

Kieran Anson
Kilo Patron

 

Hi @_Samay ,

Which API are you referring to? The following?

  • /api/sn_hr_core/case_creation/create_task

Hi @Kieran Anson - Yes. 

api/sn_hr_core/case_creation/create_task 

 

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"
    }
  }
}

Hi @Kieran Anson -Thanks for your valuable response. 

Now, I can create HR Cases from above JSON. 

But, I would like to know if this is not the best practice to create HR Case then can you please share a custom code to create HR case from REST API's