Monday.listen context does not reload when a board field is updated

I have this code, which I took from the quick start docs, in my app:

monday.listen("context", res => {
  console.log("something is happening");
  monday.api(`query ($boardIds: [Int]) { boards (ids:$boardIds) { name items() { name column_values { title text } } } }`,
    { variables: {boardIds: this.state.context.boardIds} }
  .then(res => {

When the app view of the board is reloaded, it displays all the information on in the fields on the board:

"boards": [ { "name": "Test App", "items": [ { "name": "Facebook Pixel", "column_values": [ { "title": "Status",...

However, if I have two windows open, one with the main table and one with the app view; I update a field value in the main table, but the app view json does not reload, nor do I see anything in the console logs.

I’m trying to get a proof-of-concept, just to figure out how to trigger actions when a field value is changed.

A field, in the json above, is represented in the “items” list. An “item” is a row, and column_values give you the value of each column.

Hi @iateadonut!

I would love to learn more about what you’re looking to do. I see that you embedded a monday.api() method within your monday.listen() method, and am wondering why you chose to do so?

Are you hoping to change something in your board view based off of changes made to column values in the main table? If so, you can accomplish this with the monday.listen("events") SDK method instead. This will “trigger” when an event takes place on the board.

Try this out and let me know if this works better for you!

Thank you so much!

Do you have a suggestion of the best docs/tutorial to go through to understand the SDK?

Hi @iateadonut!

Ahh sadly we don’t have a tutorial of sorts. I would say that the best way to learn about all of the methods in the SDK would be to just go through the SDK readme: GitHub - mondaycom/monday-sdk-js: Node.js and JavaScript SDK for developing over the pl.

There’s a super helpful table of contents right at the top that you can use to navigate throughout the readme as well.

Thanks again. You are a gentleman and a scholar.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.