Solved

Update phasefield using GraphQL API (How do I specify a phase?)

  • 26 April 2021
  • 5 replies
  • 562 views

Userlevel 2
  • Regular Participant
  • 3 replies

Hi,

I am trying to update phase fields in my Pipe using the following GraphQL query:

mutation {
updatePhaseField(
input: {
id: "did_you_finish_the_task"
label: "Have you finished the task?"
options: ["Yep", "Nope"]
required: false
editable: true
}
) {
phase_field {
id
label
}
}
}

As far as I can tell the only way to specify the field is through the field ID. However my account is linked to many boards and companies and there are duplicate IDs across those. For example there could be multiple fields with IDs "did_you_finish_the_task" and I don’t want to accidentally rename the wrong one.

So my question is how do I specify a certain field in a certain phase or board?

icon

Best answer by jon71 30 April 2021, 15:09

View original

5 replies

Userlevel 7
Badge +12

The query seems to work with the internal_id too (as the input’s id field’s value). That one is guaranteed to be unique, also between different phases/pipes.

Userlevel 2

Thanks for the quick response, I tried with the internal id,

mutation {
updatePhaseField(
input: {
id: "324867776"
label: "test"
}
) {
phase_field {
id
label
}
}
}

but it gave the following error:

{
"data": {
"updatePhaseField": null
},
"errors": [
{
"message": "Field not found with id: 324867776",
"locations": [
{
"line": 2,
"column": 3
}
],
"path": [
"updatePhaseField"
],
"code": 30003,
"type": "ResourceNotFoundError"
}
]
}

I tried this with a few internal ids taken from Pipefy url as well as other GraphQL querys.

Were you able to get a different result @genietim? I am running this from https://app.pipefy.com/graphiql

 

Userlevel 7
Badge +12

@jon71, I am sorry, you are right, I cannot reproduce what I thought I did before. Well then. Using extra and iid fields (e.g., I just created and tried with ”test_for_jon71”), I get a “permission denied” error.

So I guess there is indeed something wrong and Pipefy employees have to chime in.

Did you try it with an iid field in a test pipe? Are you able to change the field that way?

 

{
"data": {
"updatePhaseField": null
},
"errors": [
{
"message": "Permission denied",
"locations": [
{
"line": 2,
"column": 3
}
],
"path": [
"updatePhaseField"
],
"code": 30001,
"type": "PermissionDeniedError"
}
]
}

 

Userlevel 2

This has been resolved. You have to use id AND uuid fields as using only uuid throws an error.

internal id (e.g. 324867666) does not work.

mutation {
updatePhaseField(
input: {
id: "test_field"
uuid: "d8b8908d-77e5-47c2-bc8c-89e985822812"
label: "Test Field"
}
) {
phase_field {
id
uuid
label
phase{
name
}
}
}
}

I tested this with fields that had the same id across two pipes and it worked.

Userlevel 7
Badge +12

Awesome, thanks @jon71 . Interesting though that uuid is not documented as an input parameter...

Reply