Force "recalculate" calculated field alternatives

Hello,

Having some concerns with calculated fields and the solution employed.

Given : 2 modules , a date field date_vis on module B , a date field date_vis on module A and looking to update the date_vis of module A , set it up as calculated field in studio like maxRelatedDate($module B,"date_vis")

The problem with this approach now is that the field only updates when the module A date_vis only updates when saving the record.

As an alternative to scheduling a recalculate fields job and only recalculate the field for the current record thought of forcing the save upon record load with sidecar this.model.save();

this.once("render", this.SaveCalc, this);

  SaveCalc : function() {

  this.model.save();

  }

Are there any caveats to this asides from probably this.on or this.once render running multiple times?

I'm sure there are better ways just couldn't figure it out ? Any thoughts ? Much appreciated

Parents
  • Hmm bad idea I think , this won't work if the user doesn't visit the record page of module A after creating the record in module B.

    Another option would be to update the date_vis of module A from module B if the date_vis of module_A is < than the date_vis of module B

    record / create.js but not sure if it's possible or how to access the bean of module A from sidecar. The relation between A and B is one to many.

    Guess would have to call the app.api.buildURL() to the module A  and make an api call to update ? Anyone have some example of this?

    Is this scenario even possible? 

    Thanks.

Reply
  • Hmm bad idea I think , this won't work if the user doesn't visit the record page of module A after creating the record in module B.

    Another option would be to update the date_vis of module A from module B if the date_vis of module_A is < than the date_vis of module B

    record / create.js but not sure if it's possible or how to access the bean of module A from sidecar. The relation between A and B is one to many.

    Guess would have to call the app.api.buildURL() to the module A  and make an api call to update ? Anyone have some example of this?

    Is this scenario even possible? 

    Thanks.

Children