dvdsmpsn
(David @ David Simpson Apps)
October 31, 2024, 3:39pm
1
I have an item that is moved from one board to another.
How do you capture the board id of the original board?
In the workflow block, you can get the new board id from the context and item id from trigger output, but I can’t find a way to get the id of the original board.
The POST body currently looks something like this:
{
"payload": {
"blockKind": "action",
"inboundFieldValues": {
"boardId": 2662470531,
"itemId": 2687058843
},
"inputFields": {
"boardId": 2662470531,
"itemId": 2687058843
},
"recipeId": ...,
"integrationId": ...
},
"runtimeMetadata": {
"actionUuid": "...",
"triggerUuid": "..."
}
}
We’re moving the item between board ids:
1642425449 -> 2662470531
How do I get hold of 1642425449
in the POST body?
Hello there @dvdsmpsn ,
You can not get that from the request when using the native “When item is moved to a board” trigger.
As a workaround, what I can think about is checking the last updated boards (the one the item belonged to should be there):
{
boards(limit:100, order_by:used_at){
name
id
}
}
And then check the activity logs using those board IDs and the ID of the item, to see in which board you see the “move_pulse_from_board” event:
{
boards(ids: [1743196779, 1596123062, 1832418637, 3428809499, ...]) {
name
id
activity_logs(item_ids: 2440689797) {
data
event
}
}
}
Not super comfortable, but should work.
What do you think?
dvdsmpsn
(David @ David Simpson Apps)
November 5, 2024, 5:11pm
3
Wow, @Matias.Monday that feels both insane and pretty cool actually. Thank you.
dvdsmpsn
(David @ David Simpson Apps)
November 5, 2024, 7:18pm
4
@Matias.Monday It’s actually easier than that.
Use this query
query get_activity_logs (
$boardId: ID!,
$itemId: ID!
) {
boards(ids: [$boardId]) {
name
id
activity_logs(
item_ids: [$itemId]
) {
data
event
}
}
}
Pass in variables (boardId
is in the context, itemId
comes from the trigger output):
{
"boardId": newBoardId,
"itemId": itemId
}
In the results, look for the first event named move_pulse_into_board
, parse the JSON data string returned and look for source_board
in the JSON.
That is a great workaround @dvdsmpsn !!!
1 Like