How to get content from block list elements before node save and insert/save to a node property?

How to get content from block list elements before node save and insert/save to a node property?

On my page nodes I have a property ‘ribbons’ of type Umbraco.BlockList. I also have a text property ‘browserTitle’.

When an editor saves the document I want to traverse the ribbons and look for the first ribbon element where property ‘healine’ is not empty and put that value into the node’s ‘browserTitleResult’ property just before the node is saved.

(use case is that if ‘browserTitle’ is empty I can use ‘browserTitleResult’ for page title instead)

I have tried using examples from https://docs.umbraco.com/umbraco-cms/fundamentals/code/umbraco-services#access-in-a-custom-class-via-dependency-injection but I cant figure it out.

Umbraco 13.3.0


This is a companion discussion topic for the original entry at https://our.umbraco.com/forum/114071-how-to-get-content-from-block-list-elements-before-node-save-and-insertsave-to-a-node-property