Skip to main content
Solved

REST API null Usr fields on PUT when failing PXCheckUnique

  • February 24, 2026
  • 2 replies
  • 19 views

Forum|alt.badge.img

Hi,

Building an integration with Shopify for a client. I am using custom fields to store the order ID keys and there is a PXCheckUnique in place on this field to prevent duplication.

        #region UsrMAXXShopifyOrderID
[PXDBString(30)]
[PXCheckUnique(
Where = typeof(Where<SOOrderExt.usrMAXXShopifyOrderID,
Equal<Current<SOOrderExt.usrMAXXShopifyOrderID>>>))]
[PXUIField(DisplayName = "Shopify Order ID", Enabled = false)]
public string UsrMAXXShopifyOrderID { get; set; }
public abstract class usrMAXXShopifyOrderID : PX.Data.BQL.BqlString.Field<usrMAXXShopifyOrderID> { }
#endregion

This validation works as expected in the UI

However, if an identical request is made then in the response all Usr fields that are on the SOOrder object are null and the order is created without any of these fields created. (There is a Usr field on the SOLine that is still populated)

I have done integrations for other clients with the same set up and the behavior in these cases is that the API would return an error for the fields that field the PXCheckUnique and no order would be created.

Has anyone come across this before?

Simplified API request below, ShopifyCustomerID, ShopifyOrderID, ShopifyStoreID & Details/ShopifyLineItemID are the Usr fields. ShopifyOrderID id the only field with the PXCheckUnique property.

{
"OrderType": {
"value": "WS"
},
"CustomerID": {
"value": "CU165785"
},
"ShopifyCustomerID": {
"value": "6100247478401"
},
"ShopifyOrderID": {
"value": "4618371235969"
},
"ShopifyStoreID": {
"value": "STORE"
},
"CustomerOrder": {
"value": "SSO14612"
},
"CurrencyID": {
"value": "AUD"
},
"ExternalRef": {
"value": "4618371235969"
},
"Details": [
{
"Branch": {
"value": "VE04WEBSAL"
},
"WarehouseID": {
"value": "300MAIN"
},
"InventoryID": {
"value": "SON-CEAG240T"
},
"OrderQty": {
"value": 2
},
"UnitPrice": {
"value": 369
},
"DiscountAmount": {
"value": 0
},
"ManualDiscount": {
"value": true
},
"ShopifyLineItemID": {
"value": "11852975014017"
}
}
]
}

 

Best answer by Naveen Boga

@matthewgerdan  I think PXCheckUnique is not guaranteed as a safe uniqueness enforcement mechanism for REST API’s.  It is more of a UI validation helper.

I recommend go with the SetProperty Exeception.

 

PXCheckUnique works inside the UI graph lifecycle.

  • FieldVerifying
  • RowInserting
  • RowUpdating
  • RowPersisting
  • PXCheckUnique validation
  • Database Persist

REST API - REST may not load all records into cache.

  • REST Endpoint
  • Contract-Based API
  • Entity Graph
  • Persist()

 

 

2 replies

Naveen Boga
Captain II
Forum|alt.badge.img+20
  • Captain II
  • Answer
  • February 24, 2026

@matthewgerdan  I think PXCheckUnique is not guaranteed as a safe uniqueness enforcement mechanism for REST API’s.  It is more of a UI validation helper.

I recommend go with the SetProperty Exeception.

 

PXCheckUnique works inside the UI graph lifecycle.

  • FieldVerifying
  • RowInserting
  • RowUpdating
  • RowPersisting
  • PXCheckUnique validation
  • Database Persist

REST API - REST may not load all records into cache.

  • REST Endpoint
  • Contract-Based API
  • Entity Graph
  • Persist()

 

 


Forum|alt.badge.img
  • Author
  • Varsity I
  • February 25, 2026

Thanks ​@Naveen Boga I’ll do that