Assigning B2B Company to B2C draft order

Hi, can anyone help me with this issue? So what I did is create a draft order from a B2C order and I want to assign a B2B company on it using Flow: Admin API

Flow:
{
“id”: “{{draftOrder.id}}”,
“input”: {
“purchasingEntity”: {
“customerId”: “{{draftOrder.customer.id}}”,
“purchasingCompany”: {
“companyId”: “gid://shopify/Company/{{draftOrder.customer.company.value}}”,
“companyContactId”: “{{draftOrder.customer.id}}”,
“companyLocationId”: “gid://shopify/CompanyLocation/{{draftOrder.customer.companyLocation.value}}”
}
}
}
}

Returned error: Exception: Mutation had errors: “invalid id”
{
“id”: “gid://shopify/DraftOrder/1482593828886”,
“input”: {
“purchasingEntity”: {
“customerId”: “gid://shopify/Customer/26245964529686”,
“purchasingCompany”: {
“companyId”: “gid://shopify/Company/8077934614”,
“companyContactId”: “gid://shopify/Customer/26245964529686”,
“companyLocationId”: “gid://shopify/CompanyLocation/20738441238”
}
}
}
}

From what I can tell I’m going to take a guess that your companyContactId is incorrect, you’re trying to pass a Customer ID, not a CompanyContact ID.

Sorry, as my message is a bit messy. Here’s some screenshots. But no, I’m pulling Company ID thru customer metafields.


I’m talking about CompanyContact, not Company. You’re passing a Customer ID there.

ohhh.. sorry i misread your post. Where can I pull the ID for the company contact ID? is this the Main contact of a company? but that will still be a customer right?

Not necessarily the main contact, a company can have many contacts. But if you don’t care who the order is associated to, you could just use the main contact.

Hi @Carlo_Aquino

Is this issue resolved for you?