I am trying to write a query to fetch the companyLocationId based on the company ID.
I need the CompanyContactId, CompanyContactRoleId, and CompanyLocationId to add the ordering permission to the customer while creating them through GraphQL.
Please advise if anyone has any thoughts on this.
@NovaModule1
Certainly! To fetch the CompanyLocationId based on the CompanyId in GraphQL, you’d need to construct a query. Assuming you have a schema similar to this:
query {
company(id: "your_company_id") {
companyLocationId
companyContact {
companyContactId
companyContactRoleId
}
}
}
Replace "your_company_id" with the actual ID you’re querying for. This assumes a structure where a company has a location, and a contact associated with it.
Make sure to adapt the query based on your specific GraphQL schema. If you encounter any issues or have a different schema, feel free to provide more details for a more accurate response.
Hi Sam, Thanks for your input.
I tried writing the below query and it looks like I’m unable to get the contactId. But without the contacts in the query, I get the response.
Could you please let me know what am I missing?
Thanks.
{
companies(first: 10){
nodes{
name
id
contactRoles(first: 5){
nodes{
name
id
}
}
locations(first: 5){
nodes{
name
id
}
}
contacts(first: 5){
nodes{
name
id
}
}
}
}
}