Skip to content
Chapter

Ship To

Ship To

A Ship To is a delivery address under Sold To DIST001 (Sharma Distributors). It is a Ship_To__c record in Salesforce, not an Account. Both systems can create one. They do not share a sequence counter.

Sold To code DIST001
Sold To Salesforce Id 001000000000001AAA
Salesforce-created example Whitefield Warehouse, code DIST001_1
ERP-created example Peenya Depot, local code DIST001_1 when it is the first Ship To ERP has stored for DIST001

The code format on both sides is {SoldToCode}_{sequence} with no zero padding, so the first one is DIST001_1. Salesforce builds that in ShipToCodeService after the record exists. ERP builds the same shape in NextShipToCode before it calls Salesforce. Each counter only sees its own rows.

Who creates it What happens
Salesforce, origin Internal Inserted Active with a blank code. ShipTo_AfterSave assigns DIST001_1, then posts the finished record to ERP
Salesforce, origin Community Stays at Pending Approval and is not sent. After approval moves it to Active, the same code step runs, then the post
ERP POST /api/accounts/sold-tos/DIST001/ship-tos saves the row, then creates Ship_To__c with Origin__c = ERP and no code. Salesforce assigns its own code and does not post that record back

The JSON Salesforce posts is on Salesforce → ERP. The JSON ERP posts is on ERP → Salesforce.

Auth is the same pair as onboarding. Salesforce calls ERP through Named Credential ERP_Named_Credential. ERP calls Salesforce with OAuth client credentials against /services/data/v67.0. If ERP has no instance URL and no token, the local Ship To is still saved and nothing is written to Salesforce.

This is the last chapter. The territory on this Sold To is in the first chapter, Territory.