Is it possible to create a case of a specific case type via the Case API?

emcmanis
Tera Contributor

I have an integration that can create cases for customers based on events in an outside system. I'm currently using the Case api ( https://docs.servicenow.com/bundle/vancouver-api-reference/page/integrate/inbound-rest/concept/case-... )'s POST /sn_customerservice/case endpoint to create the cases.

 

Recently, we've configured case types and I'd like to use this same integration to create cases of a specific case type, rather than base case. Looking at the documentation, it doesn't mention anything about case types. I tried passing in sys_class_name : "My Case Type", in my request, but that didn't work at all.

 

Any ideas?

3 REPLIES 3

AshishKM
Kilo Patron
Kilo Patron

Hi @emcmanis , 

If you have added a new field/variable in application which is integrated with ServiceNow via case api , then you have to create the similar case type field ( with options ) at ServiceNow side and pass this case type value in the POST call.

First, check the Case Form/Table, if there is any field with case type, if not then created it ( with choice options) then post the request, additionally if your requiremernt to perfomr some custome action based on this case type then you have 2 options

                            1) either go with Scripted REST API which will change all existing setting/configuration

                            2) or write a BR [ insert ] on this case table with custom code. 

 

 -Thanks,

AshishKM

 


Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution

Hi @AshishKM ,

I'm using the OOB case types plugin: https://docs.servicenow.com/bundle/vancouver-customer-service-management/page/product/customer-servi...

That means that the typed case I want to create is in a table that extends Case. I'm not sure either of your solutions work for that.

 

-Ellen

JohnG3
Mega Guru

Unfortunately, I think the OOB CASE API only creates on the Case [sn_customerservice_case] table like you mentioned.

 

It seems like the sn_csm_case_types namespace only provides a GET method. 😕

JohnG3_0-1706642293690.png

 

You might consider a new REST API - Asynchronous Trigger for POST which has logic to pass your Case Type/ sys_class_name and insert to the appropriate case type table.

 

ServiceNow Documentation just for reference:

https://docs.servicenow.com/bundle/vancouver-integrate-applications/page/administer/integrationhub/c...

 

Alternatively, you might also use OOB Table API to create the new records in the Case Type tables.

 

It would be a nice enhancement for the OOB Case API to support Case Types, might be worth an Idea Portal post.