Closed ankitpatelinitio closed 5 years ago
hi @ankitpatelinitio
I can't fully understand your question, but this library is made specifically to work with SuiteCRM models and you are doing a regular query (without sanitizing input by the way).
If you just need a graphql interface for your data take a look at webonyx/graphql-php.
Also, graphql needs the response definition in advance, for example in your query you have ti.id, ti.name,
but you don't define what graphql types are those.
If that table is part of a SuiteCRM module, then you better use this as a guide https://github.com/lionixevolve/GraphQLSuiteCRm#extendingcustomizing-suitecrm-graphql-schema.
@mrbarletta I would like to get data from suite CRM using graphql. So I created a custom file to write a query to get data from the relational table.
query Kanbantodoitems($kanban_ref: String) {
Kanbantodoitems(kanban_ref: $kanban_ref) {
id
name
due_date
priority
status
todo_order
description
priority
contact_id_c
}
}
It is working fine but when I am passing first_name at that time it will give me error field not found. Because first_name is relational table field. So How can I implement relation and return relational table result.
Thanks
I am still finding hard to understand what do you mean by a relational table, SuiteCRM has models with relations, you have to use the model and its functions to get relationship data.
You can better understand this with the Account type, that has relationship with many other modules.
Here you can see how to get contacts related to the account:
https://github.com/lionixevolve/GraphQLSuiteCRM/blob/master/graphql/Schema/AccountType.php#L244
Also, please note that you are not defining fields in the build of your type
{
}
Hello, I am creating a custom schema to get data from 2 relational tables. But when I am returning relational table field from graphql query at that time it will give me field not found error. Please suggest me a solution for how to return relational table field value using graphql and suite CRM.