Skip to main content

When an item is moved from one board to another and we have a recipe sentence for that, how do you capture the old board id?

  • October 31, 2024
  • 5 replies
  • 67 views

dvdsmpsn
Forum|alt.badge.img+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?

5 replies

Matias.Monday
Forum|alt.badge.img
  • monday.com Team Member
  • November 4, 2024

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
Forum|alt.badge.img+1
  • Author
  • Participating Frequently
  • November 5, 2024

Wow, @Matias.Monday that feels both insane and pretty cool actually. Thank you.


dvdsmpsn
Forum|alt.badge.img+1
  • Author
  • Participating Frequently
  • November 5, 2024

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


Matias.Monday
Forum|alt.badge.img
  • monday.com Team Member
  • November 6, 2024

That is a great workaround @dvdsmpsn !!!


  • Participating Frequently
  • December 31, 2024

Thanks you saved my life haha