Skip to main content
Solved

How I Update value of Radio and Select via API??

  • August 31, 2020
  • 1 reply
  • 443 views

Paulo Ribas
Pipefy Staff

"Hello guys, can anybody help me?

I am not able to modify values ​​of a radio and a select. Would anyone give me an example of how I change the values via API.

 

Best answer by Marcos Carvalho

Hey Paulo, 

 

First you need to query the pipe fields to know the fields ids and the options available.

{
  pipe(id: 301418657) {
    start_form_fields {
      id
      type
      options
    }
  }
}

Payload:

 

{
  "data": {
    "pipe": {
      "start_form_fields": [
        {
          "id": "is_this_a_radio",
          "type": "radio_vertical",
          "options": [
            "Yes ",
            "No"
          ]
        },
        {
          "id": "select",
          "type": "select",
          "options": [
            "first option",
            "second option",
            "third option"
          ]
        }
      ]
    }
  }
}

 

 

Then you can fetch the data from a specific card:

 

{
  card(id: 383518002) {
    fields {
      name
      value
    }
  }
}

 

Payload:

{
  "data": {
    "card": {
      "fields": [
        {
          "name": "Select",
          "value": "second option"
        },
        {
          "name": "Is this a radio? ",
          "value": "Yes "
        }
      ]
    }
  }
}

 

 

With this mutation you can change the card value with some other option you searched before: 

 

 

mutation {
  updateFieldsValues(input: 
    {nodeId: 383518002, values: [
      {fieldId: "is_this_a_radio", value:"No"}, 
      {fieldId: "select", value: "third option"}
    ]}) {
    clientMutationId
    success
  }
}

 

 

And now you have the card values changed: 

 

{
  card(id: 383518002) {
    fields {
      name
      value
    }
  }
}


Payload: 

{
  "data": {
    "card": {
      "fields": [
        {
          "name": "Select",
          "value": "third option"
        },
        {
          "name": "Is this a radio? ",
          "value": "No"
        }
      ]
    }
  }
}

 

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

1 reply

Marcos Carvalho
Pipefy Staff
Forum|alt.badge.img+6

Hey Paulo, 

 

First you need to query the pipe fields to know the fields ids and the options available.

{
  pipe(id: 301418657) {
    start_form_fields {
      id
      type
      options
    }
  }
}

Payload:

 

{
  "data": {
    "pipe": {
      "start_form_fields": [
        {
          "id": "is_this_a_radio",
          "type": "radio_vertical",
          "options": [
            "Yes ",
            "No"
          ]
        },
        {
          "id": "select",
          "type": "select",
          "options": [
            "first option",
            "second option",
            "third option"
          ]
        }
      ]
    }
  }
}

 

 

Then you can fetch the data from a specific card:

 

{
  card(id: 383518002) {
    fields {
      name
      value
    }
  }
}

 

Payload:

{
  "data": {
    "card": {
      "fields": [
        {
          "name": "Select",
          "value": "second option"
        },
        {
          "name": "Is this a radio? ",
          "value": "Yes "
        }
      ]
    }
  }
}

 

 

With this mutation you can change the card value with some other option you searched before: 

 

 

mutation {
  updateFieldsValues(input: 
    {nodeId: 383518002, values: [
      {fieldId: "is_this_a_radio", value:"No"}, 
      {fieldId: "select", value: "third option"}
    ]}) {
    clientMutationId
    success
  }
}

 

 

And now you have the card values changed: 

 

{
  card(id: 383518002) {
    fields {
      name
      value
    }
  }
}


Payload: 

{
  "data": {
    "card": {
      "fields": [
        {
          "name": "Select",
          "value": "third option"
        },
        {
          "name": "Is this a radio? ",
          "value": "No"
        }
      ]
    }
  }
}

 


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