Skip to main content

Is it possible to use variables in GraphQL syntax for column values in a mutation? In the example below, I am can use a variable for top level items like board_id and item name. I can’t embed a variable inside column_values for date and the url. I am doing this to allow someone on my team the bulk assign training assignments through the API Playground tool instead of running a Python script I created.


Thanks

Bruce


Example 1

mutation addTraining($myBoardID: Int!, $myItemName: String) {

bruceB: create_item(

board_id: $myBoardID,

item_name: $myItemName,

column_values:

“{

"status": {"label": "New"},

"status_11": {"label": "HP Mandatory Training"},

"link" : "www.test.com Title Here",

"date4" : {"date" : "2023-05-31"},

"person": {"personsAndTeams" :s {"id" : 11111111, "kind" : "person"}]}

}”

) {

id

}


  cindi: create_item(
board_id: $myBoardID,
item_name: $myItemName,
column_values:
"{
\\"status\\": {\\"label\\": \\"New\\"},
\\"status_11\\": {\\"label\\": \\"HP Mandatory Training\\"},
\\"link\\" : \\"www.test.com Title Here\\",
\\"date4\\" : {\\"date\\" : \\"2023-05-31\\"},
\\"person\\": {\\"personsAndTeams\\" :s {\\"id\\" : 22222222, \\"kind\\" : \\"person\\"}]}
}"

) {

id

}


Variables

{

“myBoardID”: ########,

“myItemName”: “Test Training”

}

Hello there @BruceB,


You can not pass a variable into the column values from the Playground.


Let me know if you have any other questions 🙂


Cheers,

Matias


Reply