I’m trying to get data from sub items from one of the Leave Forms.
Hi @karl.arboiz,
Welcome to the community!
You can query the subitems on a board once they’re submitted through the form. Is that what you’re looking to do?
If so, check out our subitems API reference documentation here for more info!
Best,
Rachel
Yes, that’s correct. But i have a problem with using API Beta Request. Upon testing the step the response body is empty array. Attached below are the screenshots of the query and the test Data out
Hello there @karl.arboiz,
I have two questions about this that may help:
- Are you sure that the item ID you are using is correct?
- Does the user whose API token is being used in Zapier (or the platform you are using) have access to said item via the UI?
Looking forward to hearing from you!
Cheers,
Matias
Hi Matias. This is all good now, I just need help with updating the owner column in the subitems using post method in API request beta
Hello there @karl.arboiz,
You can use a query like this one to get the ID of the subitems board (which is different from the main board):
{
boards(ids: MAINBOARDIDHERE) {
columns(ids: "subitems__1") {
settings_str
}
}
}
Then you can use a query like this one to look for the ID of the “owner” column:
{
boards(ids: IDOFTHESUBITEMSBOARDHERE) {
columns {
id
title
}
}
}
Then you can populate that column with a mutation like this one (as shown here):
mutation {
change_multiple_column_values(item_id:SUBITEMIDHERE, board_id:SUBITEMBOARDIDHERE, column_values: "{\"people\" : {\"personsAndTeams\":[{\"id\":\"4616627\",\"kind\":\"person\"},{\"id\":\"4616666\",\"kind\":\"person\"},{\"id\":\"51166\",\"kind\":\"team\"}]}}") {
id
}
}
I hope that helps!
Cheers,
Matias
Actually, Matias, the goal is like this: after I ran the Code by Zapier: Run Javascript, I will get this value :
- [
{subItemID: “12345671”, subItemBoardID: “12345678”, columnID: “person”, columnValue: “123456”},
{subItemID: “12345672”, subItemBoardID: “12345678”, columnID: “person”, columnValue: “123456”},
{subItemID: “12345673”, subItemBoardID: “12345678”, columnID: “person”, columnValue: “123456”},
{subItemID: “12345674”, subItemBoardID: “12345678”, columnID: “person”, columnValue: “123456”}
]
I will then use API Request Beta to make a post method. I will simply have to update the person column of the sub item IDs with the column value.
Hello again @karl.arboiz,
That’s great!
Then all you need at that point is a mutation like this one:
mutation {
change_multiple_column_values(item_id:SUBITEMIDHERE, board_id:SUBITEMBOARDIDHERE, column_values: "{\"PEOPLECOLUMNIDHERE\" : {\"personsAndTeams\":[{\"id\":\"4616627\",\"kind\":\"person\"},{\"id\":\"4616666\",\"kind\":\"person\"},{\"id\":\"51166\",\"kind\":\"team\"}]}}") {
id
}
}