I’m working on an application that identifies formulas columns on a board and listens to changes in formulas.
I’m able to get information from the context via monday.listen(“context”), but I don’t get any callbacks on this callback, even after modifying a formula column on the board.
monday.listen("events", (res) => {
console.log(`*** now it seems the events has changed:`, res.data);
})
I was initially running the app in Preview mode with the tunnel, and I thought maybe it was due to this. So I created a new build of the app, upload it, and then loaded the app on my board.
Even after I install the app and make changes to the formula column, I cannot see anything printed in the console.
Formula columns cannot be use in this way, as formula columns are calculated and displayed outside the data layer in the browser (in the view layer).
Listening for changes calls when data in the data structure backing the board changes, such as a user changing a column will update the data structure and those changes then get pushed to the monday.com back end.
Formula columns however are based on the view layer, so no data changes occur to create the change event.
This is also why apps can’t natively use formula columns, since the values are not stored in the API (since its not getting pushed from the view to data layer).
It’s all making sense to me now. Late yesterday I tried adding new items and I got notifications on the events callback. But when I tried changing the formula I got nothing.
Do you know if there is a way to get updates to column formulas via webhooks to a back-end API?
There is not. the backend is devoid of formula values. We can return the formula itself from the column settings of a formula column, but the column value of it on an item is null.
This is, as mentioned, because the view layer doesn’t push the formula to the data later in the browser. if it did that the data layer could push to the back end.
I hope one day monday will implement formula calculations on the back end… but alas, I don’t expect that any time soon.
Your only option, is to parse the formula in the settings_str of the column and listen for changes in all of the columns in the formula. The problem with that is you don’t know if those changes actually resulted in a value change, or were in a dead path when the formula is evaluated (for example if statements)
Soon? No don’t expect it ever. Its been this way for years, and there has never been any hint of it being changed. I have zero hope of seeing that change.
They have announced calculating formulas in automations on the roadmap, but thats different than storing a formula value into the back end.