AnsweredAssumed Answered

When is a calculated field calculated ?

Question asked by toddkaufmann toddkaufmann on Sep 1, 2014
Latest reply on Sep 12, 2018 by Greg Billings
Sugar Pro 7.2.1:
I have a calculated field "Label ID" which creates a SKU-type identifier based on a prefix and a serial number.  I assign the prefix string and serial number in the before_save logic hook--this works fine.  However, my label field (a concatenation of the above fields) is not updated until the next time I edit and save the object.

This is the definition of the calculated field (in my custom module):
    concat($rr_prefix_c,"-",$rr_id_c)
very simple..

Is there some way in some hook to tell it update so this gets calculated and saved,
or explicitly call the sugar logic engine so that the value is updated?

As a workaround (HACK), I am setting this field in the hook as well, not the cleanest solution.

Outcomes