Solved

Get Connected Cards from a Known Pipe

  • 29 September 2022
  • 5 replies
  • 59 views

Userlevel 6

Background:

  • We have cards from Pipe A that have connected fields pointing to Pipe B (cards)
  • We need to find all connected cards for Pipe A from lookups for Pipe B

Which Would be Best Method To Do This

I am looking at this GraphQL API approach as the possible best route.

https://api-docs.pipefy.com/reference/objects/CardRelationship/

Using a search via Pipe ID (Pipe A’s ID) would this retrieve a list of all cards that are connected to Pipe B?

New to GraphQL so may be misunderstanding this/ there may be a much better approach/ simpler.

icon

Best answer by marcos.pedrosa 29 September 2022, 13:14

View original

5 replies

Userlevel 5
Badge

Hello there, @Keto-Faster!
Hope you’re doing alright. 

I believe the following query will assist you with this matter:

 

query{
allCards(pipeId:XXXXXXX){
edges{
node{
id
child_relations{
name
cards{
id
title
fields{
date_value
datetime_value
filled_at
float_value
indexName
name
report_value
updated_at
value
}
}
}
}
}
}
}

Hope this helps 😀

Userlevel 7
Badge +6

Hi, I’m not sure if this is exactly what you want but I did this query and it showed me the connections of a card

If you want one specific you can change child_relations to child_relations(child_repo_id: xxx)


{
  card(id: xxx) {
    id
    title
    pipe {
      name
    }
    child_relations {
      repo
      name
      cards {
        id
        title
      }
    }
  }
}
 

Userlevel 6

@marcos.pedrosa thanks for the input.

 

  1. This works well for querying the Pipe A that has the connected field to see Pipe B connected cards via those connected Fields.
  2. However, when I query Pipe B it shows no connected cards. This is because Pipe B doesn’t have the connected fields, it is Pipe A that has them.

So the question: Is it possible to reverse this query so that it works for Pipe B - to find all parent cards from specific Pipes?

Userlevel 5
Badge


@Keto-Faster 

If you want to reverse the query, you can do so, but you’ll need to change the child_relations to   parent_relations argument, when running the query in the Pipe B. 

Hope this helps you :) 

 

 

 

Userlevel 6

@marcos.pedrosa yes, thanks - that solved it. Perfect.

Reply