App reviews, troubleshooting, and recommendations
We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more
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.
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:
```graphql
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
}
}
}
}
}