New item automation

All,
We have Monday board with several phases. When all subitems in phase 1 are marked as done, the item moves to phase 2 and a few sub-items are created. What I am looking for is the ability to auto assign some of those new sub-items based on the owner of the top/main item. Looking at the automation engine, I did not find a way to do this. wondering if this is possible at all even if using API, etc. thanks.

Hello there @Somoscode,

You could use a webhook (as shown here) to receive a notification each time a sub item is created. Then in that webhook you would receive that subitem’s ID, and you can use that ID in a query like this one to get the value of who is assigned to the “parent item”:

{
  items(ids: YOURSUBITEMIDHERE) {
    parent_item {
      name
      id
      column_values(ids: "THEIDOFTHEPEOPLECOLUMNHERE") {
        value
        text
      }
    }
  }
}

Then you can use that to change the value of the people column of the subitem to based on that information, with a mutation such as this one:

mutation {
  change_simple_column_value(item_id:YOURSUBITEMIDHERE, board_id:THEIDOFTHESUBITEMSBOARDHERE, column_id:"people", value:"THEIDOFTHEUSERHERE") {
    id
  }
}

To get the ID of the subitems board, you can use a query like this one:

{
  items(ids: THESUBITEMIDHERE) {
    board {
      id
    }
  }
}

To get the IDs of your boards, you can use something like this:

{
  boards(ids: BOARDIDHERE) {
    columns {
      title
      id
    }
  }
}

To get your users’ IDs, you can use something like this:

{
  users {
    name
    id
  }
}

I hope that helps!

Cheers,
Matias