Solved

How to return values of the form?

  • 15 September 2021
  • 3 replies
  • 48 views

Userlevel 1

Hello

Currently I am able to return all card fields by using the following Query:

{ "query": "{ phase(id: <ID NUMBER>)  { cards  { edges  { node { id title fields { name value } } } } } }" }

 

However I need to also return the fields from the form attached to each card, as well as their values.

 

Is there any easy way to do that?

icon

Best answer by genietim 16 September 2021, 14:32

View original

3 replies

Userlevel 7
Badge +6

Hi,

What you are currently querying is all the card’s fields of all cards in a certain phase. I am not entirely sure what you refer to with “form attached to each card” — do you have an external integration? Or do you just mean the form as in the fields of the card?

In case you mean the latter, you already do so, though only the fields with values are returned. To query all phases and their fields of a certain pipe, no matter if there are any cards or values in that phase, you can use the following query:
 

query {
pipe(id: <pipeId>) {
name
phases{
id name fields{ id internal_id type description label}
}
start_form_fields {
id name fields{ id internal_id type description label}
}
}
}

 

This query also queries the fields of the start form, if that is what you meant by “form”. Note that your query does so too, already, include the values from the start form.

You will have to use the id of the fields to cross-assign the values you got above and the fields you got here. To get the id of the fields whose values you queried, try it like this:

 

query {
phase(id: <yourPhaseId>) {
name
cards{
edges{node{id title fields { name value field { internal_id } }}}
}
}
}

 

Note also that you will have to use pagination to get all the cards of a phase instead of just the 50 first ones.

Userlevel 1

Hello, and thanks for your answer

Attached is a print screen of the card. I think this may help

The red boxes are due confidential info, but the blue box contains the area with data that I need.

Since it is called FORMULARIO, I assumed it was a form, maybe that is the confusion. When I click on the CLIENTE field, it links me to a place called ‘DATABASE’, so maybe its not actually a form, but a table connection?

What I need is, from the card, get all the data linked on the blue box.

Currently, it is being returned as ‘Cliente → [“CLIENT NAME”]’, which is kinda weird that it only returns the name.

Userlevel 7
Badge +6

Ah, I see. What you want is to get the connected cards together with the card you query.

This works e.g. like so:

query {
phase(id: <yourPhaseId>) {
name
cards {
edges {
node {
id
title
fields {
name
value
field {
internal_id
}
}
child_relations {
pipe {
name
}
name
cards {
fields {
name
array_value
value
field {
id
internal_id
}
}
child_relations {
pipe {
name
}
name
cards {
fields {
name
array_value
value
field {
id
internal_id
}
}
child_relations {
pipe {
name
}
name
cards {
fields {
name
array_value
value
field {
id
internal_id
}
}
}
}
}
}
}
}
}
}
}
}
}

This example goes actually already a bit further: it queries not only the first-level connections, but up to 3 levels (e.g. the client connection again has a connection to, say, address, which then again has a connection, to e.g. a country database).

Reply