Account lifecycle¶
After distributor onboarding, Sharma Distributors already exists on both sides.
| Sold To code | DIST001 |
| Sold To Salesforce Id | 001000000000001AAA |
| Bill To code | BILL001 |
| Bill To Salesforce Id | 001000000000002AAA |
| Status | Active |
From here, ERP is the only system that changes the master. A user or another ERP process calls the ERP account API. ERP saves its own row first, then patches Salesforce with the stored Account Id. Salesforce does not send these changes the other way.
| Change | ERP API that starts it | What ERP then sends to Salesforce |
|---|---|---|
| Edit the Sold To | PATCH /api/accounts/sold-tos/DIST001 |
PATCH /sobjects/Account/001000000000001AAA |
| Edit the Bill To | PATCH /api/accounts/bill-tos/BILL001 |
PATCH /sobjects/Account/001000000000002AAA |
| Add a Bill To | POST /api/accounts/sold-tos/DIST001/bill-tos |
POST /sobjects/Account |
| Freeze, unfreeze, deactivate, activate | PATCH /api/accounts/sold-tos/DIST001/{action} or the same under bill-tos |
PATCH of Account_Status__c |
The JSON for each Salesforce call is on ERP → Salesforce. What Salesforce returns, including the record-id callback for a new Bill To, is on Salesforce → ERP.
The Sold To update is not a sparse patch. ERP expects the whole master: name, GSTIN, PAN, address, bank, payment terms, and territory. A blank GSTIN, PAN, address, or territory is rejected before anything is saved. A blank payment terms value is stored as Net 30. Allowed terms are Net 15, Net 30, Net 45, Net 60, and Net 90.
An inactive account cannot be edited, frozen, or given a new Bill To. Activate it first. Freeze of an account that is already frozen does not call Salesforce again.
A delivery address under this Sold To is the next chapter, Ship To.