Solved

How to return values of the form?

  • 15 September 2021
  • 6 replies
  • 553 views

Userlevel 2

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

This topic has been closed for comments

6 replies

Userlevel 7
Badge +12

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 2

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 +12

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).

Userlevel 2
Badge

Hi, I am looking for query something similar. Instead of getting value of all cards of a phase; i need start form details of 1 specific card only(using the card id).
Is this possible?

I am relatively new to graphql, i apologize if this is a naïve question.

Userlevel 7
Badge +12

Hi @wf-suchit-gupta 

Yes, this is very much possible.

Please ask the question in a new post (feel free to tag me so I can answer immediately), so that it is easier to find for future searchers

Userlevel 7
Badge +9

Hi @wf-suchit-gupta, hope you are fine!
You can use this query to get value from a specific card:
 

{  card(id: 2712489) {    title    assignees {      id    }    comments {      text    }    comments_count    current_phase {      name    }    done    due_date    fields {      name      value    }    labels {      name    }    phases_history {      phase {        name      }      firstTimeIn      lastTimeOut    }    url  }}