Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

unable to update a record in table using Patch/Put

JayS04066785221
Tera Contributor

I'm trying to update a specific record in a table using the following API

 

https://docs.servicenow.com/bundle/vancouver-api-reference/page/integrate/inbound-rest/concept/c_Tab...

 

but doesn't seem to be working. I get a 200 response back so it seems to be processing but the approval state does not change from 'Not Yet Requested' to 'approved' 

body = '{'approval': 'approved'}'

requests.put(
            f"{sf_endpoint_url}/api/now/table/change_request/{sys_id}",
            data=json.dumps(body),
            headers=headers,
            timeout=30
        )
4 REPLIES 4

Dr Atul G- LNG
Tera Patron

Hi @JayS04066785221 

 

Is any workflow stopping?

*************************************************************************************************************
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/dratulgrover [ Connect for 1-1 Session]

****************************************************************************************************************

chaithu1489
Kilo Sage

I have tried the exact same steps mentioned by you. The approval field is getting updated.


luffy3478_0-1712325944023.pngluffy3478_1-1712325956935.png

 

JayS04066785221
Tera Contributor

I am able to modify other fields except for approval state. It seems like i'm missing some mandatory fields but can't figure it out. when i try to create a change request with approved state already, i get the following error but they are all present.

 

{"error":{"message":"Operation Failed","detail":"Data Policy Exception: \\n\\tThe following fields are mandatory: Pre-change testing, Downtime required, Change model, Validation plan, Remediation plan, IT communication, Planned start date, Reported CI, Planned end date, Implementation plan, Requested by, Short description, Assignment Group, Description"},"status":"failure"}'
 
 
 
{"error":{"message":"Operation Failed","detail":"Data Policy Exception: \\n\\tThe following fields are mandatory: Pre-change testing, Downtime required, Change model, Validation plan, Remediation plan, IT communication, Planned start date, Reported CI, Planned end date, Implementation plan, Requested by, Short description, Assignment Group, Description"},"status":"failure"}'
url:
'https://xxxxxxxxx.service-now.com//api/now/table/change_request'

From the look of the log. Your custom data policies are restricting.