Skip to content

Commit

Permalink
add update customer company docs
Browse files Browse the repository at this point in the history
  • Loading branch information
preslavmihaylov committed Apr 18, 2024
1 parent 4d290da commit 4644851
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 7 deletions.
40 changes: 40 additions & 0 deletions _snippets/graphql/update-customer-company.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
```graphql Mutation
mutation updateCustomerCompany(
$customerId: ID!,
$companyId: ID!,
$companyDomainName: String!
) {
updateCustomerCompany(
input: {
customerId: $customerId,
companyIdentifier: {
companyId: $companyId,
companyDomainName: $companyDomainName
}
}
) {
customer {
id
company {
id
name
logoUrl
domainName
}
}
error {
message
type
code
}
}
}
```

```json Variables
{
"customerId": "c_01H14DFQ4PDYBH398J1E99TWSS",
"companyId": "co_01HRRMRPERZCK42HTPD4JQ57NB",
"companyDomainName": "nike.com"
}
```
2 changes: 1 addition & 1 deletion api-reference/graphql/companies.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ Companies allow you to identify which company a customer is part of. Plain autom

A customer can only belong to a single company.

Apart from seeing which company a customer is part of, you can also list all customers associated to a given company.
Apart from seeing which company a customer is part of, you can also list all companies you've interacted with.
13 changes: 7 additions & 6 deletions api-reference/graphql/companies/update-customer-company.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,21 @@ title: 'Update customer company'
sidebarTitle: 'Update customer company'
---

You can add a customer to multiple tenants.
Plain automatically derived a customer's company for you, but you can also update it manually.

When selecting the customer you can chose how to identify them. You can use the customer's email, externalId or id.
Both customer and company are identified by their Plain ids (respectively, `c_...` and `co_...`).

If you wish to only remove the customer's associated company, then you can pass `null` as the `companyIdentifier`.

For this mutation you need the following permissions:

- `TODO`
- `TODO`
- `customer:edit`

<Tabs>
<Tab title="Typescript SDK">
<Snippet file="typescript-sdk/add-customer-to-tenants.mdx" />
<Snippet file="typescript-sdk/update-customer-company.mdx" />
</Tab>
<Tab title="GraphQL">
<Snippet file="graphql/add-customer-to-tenants.mdx" />
<Snippet file="graphql/update-customer-company.mdx" />
</Tab>
</Tabs>

0 comments on commit 4644851

Please sign in to comment.