Can we modify the 'status' in the response body?

Ankita9
Tera Contributor

Hi All,

I am working on a Webservice(Import Set API), Customer want 'status' field to be be customized based on the fields update. Can we modify the 'status' in the response body?

 

import_set": "ISET0411424",
    "staging_table": "x__rest_cmdb",
    "result": [
        {
            "transform_map": "En REST CMDB",
            "table": "cmdb_ci",
            "display_name": "name",
            "display_value": "Test",
            "record_link": "https://abc/api/now/table/cmdb_ci/54bfc1551b219910ba51c8866e4bcb91",
            "status": "inserted",
            "sys_id": "54bfc1551b219910ba51c8866e4bcb91",
1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

not possible. the status you highlighted is as per the status field on the import set table and is OOB and cannot be customized.

you can set custom response and add a json key value if required using the response variable in onAfter transform script

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

3 REPLIES 3

Pavankumar_1
Mega Patron

Hi,

It is not possible if you are working on the Import set API.

If you want to set the custom messages then need to build Scripted REST API.

Refer this link to set custom response messages and status code.

https://community.servicenow.com/community?id=community_article&sys_id=59a7b3fa1bc1995086b3ece6b04bcb1f

 

Hope it helps!!

Please Mark Correct if applicable, Thanks!! 

 

Regards

Pavankumar

If it helps please click Accept as Solution/hit the Thumb Icon.
ServiceNow Community MVP 2024.
Thanks,
Pavankumar

Harneet Sital
Mega Sage
Mega Sage

Hi Ankita, 

Looks like we can't modify the status attribute but there are a couple of workarounds you can do - 

1. Set a custom attribute to the status you want to set and ask the customer to refer to this custom attribute. Import set APIs to allow custom responses but to limited fields - details are here 

https://community.servicenow.com/community?id=community_article&sys_id=24e2a8d5db05c1d0dd886c8e13961...

2. Create a scripted web service, ask the customer to call this scripted web service and in turn in this scripted web service you call the import set API and customize the response output the way you want to send it to the customer endpoint. 

Hope this helps. 

 


Thanks
-Harneet Sital
Request you to please mark my answer as helpful or correct based on the impact

Find all my ServiceNow articles here

 

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

not possible. the status you highlighted is as per the status field on the import set table and is OOB and cannot be customized.

you can set custom response and add a json key value if required using the response variable in onAfter transform script

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader