W044: Create customer
Creates a new customer record. Triggered from the Customers page, "New customer". Classification rows (type, segment, broker) and parent (for hierarchy) are optional but, if supplied, must already exist in this org.
Steps
-
Validate optional classification refs. Confirm any supplied type, segment, and broker exist in this org and are active.
-
Validate parent if supplied. Confirm the parent customer exists in this org. Cycle prevention is trivial on create but the check is left in for symmetry with update (W047).
-
Insert the customer. Call
Customers.createCustomerwith the header fields.
Returns
The new customer.
Business rules
- Classifiers are optional. Type, segment, and broker are soft classifiers; a customer can exist with none of them set.
- Parent must be same org. Cross-org parent links are rejected.
Errors
NotFoundError. A referenced type, segment, broker, or parent was not found.