Salesforce → ERP¶
Salesforce does not push categories, products, or bundle lines to ERP. There is no webhook and no ERP_Integration_Setting for Product_Category__c or Product_Master__c. ERP is the caller. What comes back is the HTTP result of that call.
Category and product upsert¶
Both upserts are a PATCH by external id.
| Object | Path |
|---|---|
| Category | /services/data/v67.0/sobjects/Product_Category__c/Category_Code__c/CAT-TEA |
| Product | /services/data/v67.0/sobjects/Product_Master__c/Product_Code__c/TEA-500 |
A code Salesforce has never seen is HTTP 201:
ERP stores id on the category or the product as salesforceRecordId. The create or update API the caller used has already been answered with the saved row. A failed upsert leaves that row at syncStatus Failed.
A code Salesforce already has is HTTP 204 and an empty body.
ERP reads that as a failure: category upsert: empty id (status 204) or product upsert: empty id (status 204). The local row becomes Failed. The id stored from the first 201 is left in place. The Salesforce record was updated. The next sync sends the same PATCH and gets 204 again.
A product failure also posts the failed Integration Log. A category failure does not.
A validation failure is the Salesforce error array. On POST /api/products and POST /api/product-categories the caller still receives the saved row. On the explicit sync-to-salesforce call the answer is HTTP 500 internal_error with message internal server error.
Bundle component¶
Replacing the lines of TEA-GIFT is three calls.
The query answers HTTP 200. records is empty when the bundle has no lines yet.
{
"totalSize": 1,
"done": true,
"records": [
{ "Id": "a0B000000000001AAA", "attributes": { "type": "Bundle_Component__c" } }
]
}
Each delete answers HTTP 204 with an empty body. ERP treats that empty body as success.
Each create answers HTTP 201:
ERP requires id and does not store it. An empty id fails the product sync, the product is marked Failed, and the failed Integration Log is posted. Lines already deleted in that replace stay deleted.