Skip to main content

Solutions for Tag Update via API

  • February 2, 2022
  • 3 replies
  • 424 views
Solutions for Tag Update via API
Lucas Democh
Forum|alt.badge.img+15

I identified 3 ways to update tags through GraphiQL. You should use the most appropriate format for your process.

 

Scenario A) Updating a single tag.

 

Solution 1: This is the simplest scenario and should only be used if your Pipe has only one label field.

 

mutation{    updateCardField(input: {                   
card_id: XXXXXXXX      	  
field_id:"label_1"    	           
new_value:"XXXXXXXX"     })   
{       clientMutationId       success   } }

In this format, as the update is from a field to a label, there is no problem.

 

Scenario B) Updating multiple labels in different fields.

 

For this scenario, there are several solutions, as simply updating the label fields does not guarantee that the card labels are properly updated / synchronized with the Card labels.

 

Solution 2: Update more than one tag field, each field with a tag.

mutation{   
m1: 
updateCardField(input:{      
card_id:XXXXXXXX      
field_id:"label_1",new_value:"XXXXXXXX"     }   ) 
{     card {       id     }   }

m2: 
updateCardField(input:{      
card_id:XXXXXXXX      
field_id:"label_2",new_value:"XXXXXXXX"     }   )  
{     card {       id     }   }   

}   

In this scenario, you can update multiple fields in sequence. Each with its proper label.

In the first update, Pipe will recognize the tags and will synchronize them with the Card, however, if a second update is made (Tag Replacement), only the first mutation will be recognized/synchronized. The other fields will be updated, but the labels will not appear on the Card.

 

Solution 3: Update multiple labels in a single field.

This solution is similar to the first one. The difference is that instead of informing only the ID of a label, you will inform all the IDs in array format.

 

mutation{   
updateCardField(input:{     
card_id:XXXXXXXX     	
field_id:"label_1"    		 
new_value:["XXXXXXXX","XXXXXXXX","XXXXXXXX"]   }) 
{     clientMutationId     success   } }

 

I hope these tips can be helpful.

 

Do you use any different solution?

 

Did this topic help you find an answer to your question?

3 replies

Juliana Spinardi
Pipefy Staff
Forum|alt.badge.img+8

Awesome, Lucas. Thanks for sharing it with our Community! 


genietim
Forum|alt.badge.img+12
  • Pipefy Legend
  • 412 replies
  • February 2, 2022

Yes, I use a different solution! Awesome how many there are.

I use the following (does not use a field):

mutation {
  updateCard(input: { card_id: "xxxx", labelIds: ["xyxy", "zazaza"] }) {
    clientMutationId
  }
}

 


Lucas Democh
Forum|alt.badge.img+15
  • Author
  • Pipefy Legend
  • 396 replies
  • February 2, 2022

Nice @genietim!

Your solution is very interesting too. It is for when there are no specific tag fields.

I normally leave all tags as fields as well. So I can use them in report and dashboard filters.

 


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings