Update record via set function for a Smart Field


I have created an editable Smart Field, Practice Areas, with type [String] on a collection called cases. When I edit this field, I make a call to a 3rd party service which aggregates all the information about Practice Areas, based on the string selected, and I would like to update the record in Forest and in my MongoDB database. Is there a simple way to achieve this update?

Hello @Mihai_Chiciu, :wave:

For sure, it’s totally possible. In the older agent version, you can change the set function and do your own business logic. In the agent version, you can apply the same logic by overriding the write of any field.

  • What version of the forest agent are you using?

Kind regards,

Hi @morganperre, thanks for the quick response.

I am using forest-express-mongoose v7.7.1 . Which solution should I use?

Hello :wave:,

Morgan is currently on leave so I will take over. With your version you have to use the first solution (older agent version) :slightly_smiling_face:

Kind regards,