Skip to main content
Solved

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


jon71
  • New 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?

Best answer by jon71

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.

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

5 replies

genietim
Forum|alt.badge.img+12
  • Pipefy Legend
  • 412 replies
  • April 26, 2021

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.


jon71
  • Author
  • New Participant
  • 3 replies
  • April 26, 2021

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

 


genietim
Forum|alt.badge.img+12
  • Pipefy Legend
  • 412 replies
  • April 26, 2021

@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"
        }
    ]
}

 


jon71
  • Author
  • New Participant
  • 3 replies
  • Answer
  • April 30, 2021

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.


genietim
Forum|alt.badge.img+12
  • Pipefy Legend
  • 412 replies
  • April 30, 2021

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


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