PO State Change via REST API – Requested to Ordered Not Working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hello Community,
I am automating the procurement flow in ServiceNow via REST APIs from a Node.js application.
Current status:
- Service Request and RITM are created successfully
- Purchase Order and PO Line Items are created
Issue: When updating the Purchase Order state from Requested to Ordered via REST API, the API always returns 200 OK, but the state does not change
I also plan to:
- Perform PO receiving via API
- Create assets dynamically via API after receiving
Questions:
1. Is the full PO lifecycle (Requested → Ordered → Received → Asset creation) supported via REST APIs in ServiceNow?
2. If not recommended, what is the correct technical justification (platform constraints, internal workflows, UI actions, etc.)?
3. Even if achievable, is driving the entire purchase flow externally via APIs considered a best practice, or should this remain within ServiceNow workflows?
Looking forward to expert guidance.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
In your environment, if you manually view a PO that is created by this process, are you able to manually change the State from Requested to Ordered, or is there a mandatory field or something preventing this update? In the REST API payload, are you using the correct field name 'status' and value 'ordered'?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @Brad Bowman ,
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Out of the box, the 'Order' UI Action is only updating the status field to 'ordered', and there is nothing in place to prevent this via script, so unless you have customizations in your instance it should work. Try a simple fix script on an existing PO record like:
var po = new GlideRecord('proc_po');
if (po.get('39e8bb6c37423000158bbfc8bcbe5d4b')) {
po.status = 'ordered';
po.update();
}
Does this work? Are you doing the same via API or also attempting other updates simultaneously? Does anything show in the system logs when the API runs?
