Create, update or delete a company

distru-mutate-companyWrite

Creates, 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.

FieldTypeRequiredDescription
actionenum
CREATEUPDATEDELETE
Yes
idstringNoRequired for UPDATE and DELETE. Resolve via distru-search-companies.
namestringNoRequired for CREATE. Write - for – and ' for ’. Allowed: letters, digits, spaces and the symbols _ ~ # - $ / | % & ' ( ) .
legalBusinessNamestringNo
phonestring or nullNoSend null to clear it.
emailstring or nullNoSend null to clear it.
outstandingBalanceThresholdinteger or nullNooutstandingBalanceThreshold 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.
categorystring or nullNoResolve via distru-search-lookups (type COMPANY_CATEGORY). Send null to clear it.
relationshipTypeIdstring or nullNoResolve via distru-search-lookups (type RELATIONSHIP_TYPE). Send null to clear it.
groupIdstring or nullNoResolve via distru-search-lookups (type COMPANY_GROUP). Send null to clear it.
ownerIdstring or nullNoSales rep. Resolve via distru-search-users. Send null to clear it.
defaultPaymentTermIdstring or nullNoResolve via distru-search-lookups (type PAYMENT_TERM). Send null to clear it.
defaultInventoryLocationIdstring or nullNoOne of your own locations: the default inventory source on this company's sales orders. Resolve via distru-search-locations. Send null to clear it.
invoiceEmailstring or nullNoWhere invoices are emailed. Comma-separated for several. Send null to clear it.
salesOrderEmailstring or nullNoWhere sales orders are emailed. Comma-separated for several. Send null to clear it.
purchaseOrderEmailstring or nullNoWhere purchase orders are emailed. Comma-separated for several. Send null to clear it.
orderShipmentEmailstring or nullNoWhere order shipments are emailed. Comma-separated for several. Send null to clear it.
defaultSalesOrderNotesstring or nullNoCopied onto new orders. Send null to clear it.
defaultPurchaseOrderNotesstring or nullNoCopied onto new orders. Send null to clear it.
websitestring or nullNoSend null to clear it.
descriptionstring or nullNoSend null to clear it.
customFieldsobject[]NoOnly the fields listed change. Required custom fields must be set, on update too, while still blank.
customFields[].customFieldIdstringYesResolve via distru-search-custom-fields (entityType COMPANY).
customFields[].valuestring or string[]YesTEXT: 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

FieldTypePresenceDescription
companyobjectAlways
company.idstringAlways
company.namestringNull or absent
company.isMyCompanybooleanAlways
company.customFieldsobject[]Always
company.customFields[].customFieldobjectAlways
company.customFields[].customField.idstringAlways
company.customFields[].customField.namestringAlways
company.customFields[].customField.fieldTypeenum
CHECKBOXDATEDROPDOWNTEXT
Always
company.customFields[].valuestringCan be nullNull when unset. DATE values are days (YYYY-MM-DD) in the company timezone; CHECKBOX values are the selected option names, separated by commas.
company.legalBusinessNamestringNull or absent
company.categorystringNull or absent
company.creditBalancestringNull or absent
company.outstandingBalancestringNull or absent
company.pastDueBalancestringNull or absent
company.outstandingBalanceThresholdintegerNull or absent
company.invoiceEmailstringNull or absent
company.defaultPaymentTermobjectNull or absent
company.defaultPaymentTerm.idstringAlways
company.defaultPaymentTerm.namestringNull or absent
company.ownerobjectNull or absent
company.owner.idstringAlways
company.owner.fullNamestringNull or absent
company.defaultInventoryLocationobjectNull or absent
company.defaultInventoryLocation.idstringAlways
company.defaultInventoryLocation.namestringNull or absent
company.lastOrderDatestringNull or absent
company.relationshipTypeobjectNull or absent
company.relationshipType.idstringAlways
company.relationshipType.namestringAlways
company.groupobjectNull or absent
company.group.idstringAlways
company.group.namestringAlways
company.emailstringNull or absent
company.phonestringNull or absent
company.websitestringNull or absent
company.qbCustomerIdstringNull or absent
company.qbCustomerobjectNull or absent
company.qbCustomer.displayNamestringAlways
company.qbCustomer.activebooleanAlways
company.qbCustomer.isDeletedbooleanAlways
company.qbVendorIdstringNull or absent
company.qbVendorobjectNull or absent
company.qbVendor.displayNamestringAlways
company.qbVendor.activebooleanAlways
company.qbVendor.isDeletedbooleanAlways
company.leaflinkBrandIdstringNull or absent
company.leaflinkCustomerIdstringNull or absent
company.usStatestringNull or absent
company.descriptionstringNull or absent
company.defaultSalesOrderNotesstringNull or absent
company.defaultPurchaseOrderNotesstringNull or absent
company.salesOrderEmailstringNull or absent
company.orderShipmentEmailstringNull or absent
company.purchaseOrderEmailstringNull or absent

Result with id

FieldTypePresence
idstringAlways
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.