This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

SWSD API - purchase_orders - Custom fields not returned in API output

When getting a list of purchase orders from the purchase_orders endpoint of the SWSD API it is not including custom fields.  Any ideas on how to retrieve the custom values in a purchase order via the API?

Parents
  • if the purchase order you're looking at was created before you added custom fields to purchase orders module, you may not see those fields in the API response. Once you update the custom fields on that PO or create a new PO you should see the fields. Let me know if that solves it for you!

  • I created a new purchase order and confirmed the custom fields are not being returned by the API.  Included sample json output from the API for this purchase order along with a screenshot of the custom fields.  The custom field exists in the scope 'Global' from the Service Desk->Custom Fields setup page(in case purchase order specific custom fields need to be created somewhere else that I am not yet aware of)?

    {"id":298415,"name":"Test - Custom Fields Present(in API view) on new purchase order?","href":"/purchase_orders/298415.json","number":1377,"state":"Draft","notes":"API Test - Not an actual purchase order request.  Seeing if custom fields are returned via API on new purchase orders.","requester":{"id":5551080,"name":"Ben","href":"/users/5551080"},"buyer":{"id":5551080,"name":"Ben","href":"/users/5551080"},"vendor":{"id":468801,"name":"Amazon","href":"/vendors/468801"},"created_at":"2022-10-31T10:47:16.000-07:00","updated_at":"2022-10-31T10:47:16.000-07:00","order_date":"2022-10-31T00:00:00.000-07:00","purchase_order_items":[],"total_cost":"0.01 USD","currency":"USD","tax":0.0,"shipping_handling":0.01,"billing_address":"n/a","shipping_address":"","payment_terms":"","terms_conditions":"","site":{"id":128244,"name":"test name","href":"/sites/128244"},"department":{"id":185447,"name":"Information Technology","href":"/departments/185447"}}

Reply
  • I created a new purchase order and confirmed the custom fields are not being returned by the API.  Included sample json output from the API for this purchase order along with a screenshot of the custom fields.  The custom field exists in the scope 'Global' from the Service Desk->Custom Fields setup page(in case purchase order specific custom fields need to be created somewhere else that I am not yet aware of)?

    {"id":298415,"name":"Test - Custom Fields Present(in API view) on new purchase order?","href":"/purchase_orders/298415.json","number":1377,"state":"Draft","notes":"API Test - Not an actual purchase order request.  Seeing if custom fields are returned via API on new purchase orders.","requester":{"id":5551080,"name":"Ben","href":"/users/5551080"},"buyer":{"id":5551080,"name":"Ben","href":"/users/5551080"},"vendor":{"id":468801,"name":"Amazon","href":"/vendors/468801"},"created_at":"2022-10-31T10:47:16.000-07:00","updated_at":"2022-10-31T10:47:16.000-07:00","order_date":"2022-10-31T00:00:00.000-07:00","purchase_order_items":[],"total_cost":"0.01 USD","currency":"USD","tax":0.0,"shipping_handling":0.01,"billing_address":"n/a","shipping_address":"","payment_terms":"","terms_conditions":"","site":{"id":128244,"name":"test name","href":"/sites/128244"},"department":{"id":185447,"name":"Information Technology","href":"/departments/185447"}}

Children