Skip to main content

"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.

 

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": e
{
"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: 0
{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"
}
]
}
}
}

 


Reply