Angular Observers query

Hi,

I am wanting to create a sidebar widget, that responds to changes to a specific field on a record. I have sidebars (custom ones) working okay, I have got the RecordViewStore imported and it has data in it, I can check the mode, pull out what looks like fields and their contents, however when I try and subscribe to changes to the field entries its not repsonding (other subscriptions are working okay), can someone tell we exactly what I should be listening to, to trigger an update when a user “edits” a specific field please?

Kind regards

Mark

I know around 0.5% of what is needed to answer your question, but since I fear you might not get many answers from specialists here, let me just try a tip:

Does it help to have a look at how the Field logic feature (example) sets up the handler to apply logic when a field changes?

initDependencyHandlers function → https://github.com/salesagility/SuiteCRM-Core/blob/master/core/app/core/src/lib/fields/base/base-field.component.ts#L98

or maybe this

subscribeValueChanges → https://github.com/salesagility/SuiteCRM-Core/blob/master/core/app/core/src/lib/fields/base/base-field.component.ts#L253

Unfortunately no, that doesn’t help, I found and looked at that, but fields use this.field or this.record.fields[fieldname], none of which is available in a sidebar.

I have managed to get recordviewstore loaded which has a reference to record ( and therefore fields ) which you can subscribe to. Unfortunately they don’t trigger when a field changes so it’s the wrong place to be looking.

Regards

Mark

Thanks for the suggestions there, while those examples didn’t help in and of themselves, they did lead to the answer (I back tracked from the field to the row etc.). I have worked it out and am successfully getting these values now. Once I get a chance I will flesh out the answer a bit to let others know as well.

Regards

Mark

1 Like

:clap:

Please do document how you did it, when you get a chance. It will surely be useful.