Create, update or delete a company
distru-mutate-companyWriteCreates, updates or deletes one customer or vendor company; UPDATE also takes your own company (isMyCompany), which DELETE refuses.
Inputs
Every tool also takes the common inputs.
| Field | Type | Required | Description |
|---|---|---|---|
| action | enumCREATEUPDATEDELETE | Yes | |
| id | string | No | Required for UPDATE and DELETE. Resolve via distru-search-companies. |
| name | string | No | Required for CREATE. Write - for – and ' for ’. Allowed: letters, digits, spaces and the symbols _ ~ # - $ / | % & ' ( ) . |
| legalBusinessName | string | No | |
| phone | string or null | No | Send null to clear it. |
| string or null | No | Send null to clear it. | |
| outstandingBalanceThreshold | integer or null | No | outstandingBalanceThreshold is the company's balance threshold, in dollars, compared with its outstanding balance or, if your company settings choose it, its past due balance: above it Distru shows warnings and sends alerts, and unless your company settings allow orders over it, this company's sales orders can't move past Pending; null uses your company's default threshold. Send null to clear it. |
| category | string or null | No | Resolve via distru-search-lookups (type COMPANY_CATEGORY). Send null to clear it. |
| relationshipTypeId | string or null | No | Resolve via distru-search-lookups (type RELATIONSHIP_TYPE). Send null to clear it. |
| groupId | string or null | No | Resolve via distru-search-lookups (type COMPANY_GROUP). Send null to clear it. |
| ownerId | string or null | No | Sales rep. Resolve via distru-search-users. Send null to clear it. |
| defaultPaymentTermId | string or null | No | Resolve via distru-search-lookups (type PAYMENT_TERM). Send null to clear it. |
| defaultInventoryLocationId | string or null | No | One of your own locations: the default inventory source on this company's sales orders. Resolve via distru-search-locations. Send null to clear it. |
| invoiceEmail | string or null | No | Where invoices are emailed. Comma-separated for several. Send null to clear it. |
| salesOrderEmail | string or null | No | Where sales orders are emailed. Comma-separated for several. Send null to clear it. |
| purchaseOrderEmail | string or null | No | Where purchase orders are emailed. Comma-separated for several. Send null to clear it. |
| orderShipmentEmail | string or null | No | Where order shipments are emailed. Comma-separated for several. Send null to clear it. |
| defaultSalesOrderNotes | string or null | No | Copied onto new orders. Send null to clear it. |
| defaultPurchaseOrderNotes | string or null | No | Copied onto new orders. Send null to clear it. |
| website | string or null | No | Send null to clear it. |
| description | string or null | No | Send null to clear it. |
| customFields | object[] | No | Only the fields listed change. Required custom fields must be set, on update too, while still blank. |
| customFields[]. | string | Yes | Resolve via distru-search-custom-fields (entityType COMPANY). |
| customFields[]. | string or string[] | Yes | TEXT: the text. DROPDOWN: the option name. CHECKBOX: an array of option names. DATE: YYYY-MM-DD, company timezone. "" or [] clears the field. |
Output
This tool returns one of 2 shapes, depending on its inputs.
Presence on a nested field assumes its parent exists.
Result with company
| Field | Type | Presence | Description |
|---|---|---|---|
| company | object | Always | |
| company. | string | Always | |
| company. | string | Null or absent | |
| company. | boolean | Always | |
| company. | object[] | Always | |
| company. | object | Always | |
| company. | string | Always | |
| company. | string | Always | |
| company. | enumCHECKBOXDATEDROPDOWNTEXT | Always | |
| company. | string | Can be null | Null when unset. DATE values are days (YYYY-MM-DD) in the company timezone; CHECKBOX values are the selected option names, separated by commas. |
| company. | string | Null or absent | |
| company. | string | Null or absent | |
| company. | string | Null or absent | |
| company. | string | Null or absent | |
| company. | string | Null or absent | |
| company. | integer | Null or absent | |
| company. | string | Null or absent | |
| company. | object | Null or absent | |
| company. | string | Always | |
| company. | string | Null or absent | |
| company. | object | Null or absent | |
| company. | string | Always | |
| company. | string | Null or absent | |
| company. | object | Null or absent | |
| company. | string | Always | |
| company. | string | Null or absent | |
| company. | string | Null or absent | |
| company. | object | Null or absent | |
| company. | string | Always | |
| company. | string | Always | |
| company. | object | Null or absent | |
| company. | string | Always | |
| company. | string | Always | |
| company. | string | Null or absent | |
| company. | string | Null or absent | |
| company. | string | Null or absent | |
| company. | string | Null or absent | |
| company. | object | Null or absent | |
| company. | string | Always | |
| company. | boolean | Always | |
| company. | boolean | Always | |
| company. | string | Null or absent | |
| company. | object | Null or absent | |
| company. | string | Always | |
| company. | boolean | Always | |
| company. | boolean | Always | |
| company. | string | Null or absent | |
| company. | string | Null or absent | |
| company. | string | Null or absent | |
| company. | string | Null or absent | |
| company. | string | Null or absent | |
| company. | string | Null or absent | |
| company. | string | Null or absent | |
| company. | string | Null or absent | |
| company. | string | Null or absent |
Result with id
| Field | Type | Presence |
|---|---|---|
| id | string | Always |
What the AI reads
Creates, updates or deletes one customer or vendor company; UPDATE also takes your own company (isMyCompany), which DELETE refuses. Add its licenses, locations (addresses) and contacts with distru-mutate-company-license, distru-mutate-company-location and distru-mutate-company-contact; apply the same change to many companies with distru-bulk-update-companies. Read current values with distru-get-company first. DELETE soft-deletes the company, its contacts and the products it vendors (with their batches), as deleting it in Distru does; those products are deleted even if they have stock or order history; orders, invoices and credits stay. CREATE and UPDATE return the company as distru-get-company does; DELETE returns its id. Sparse update: UPDATE changes only the fields sent; a field sent as null is cleared.