Calculated field disappears after saving the record

Hi there,

I wanted to achieve the following : 

Our account records have a default solution architect (SA) picked from the Users module via Releated field.

When an opportunity is created , we want to take the choosen SA from the account as initial SA for the opportunity.

However, the user is allowed to change that opportunity SA afterwards.

So I've added a calculated text field Solution Achitect Ini to store the SA from the account.

(formula used is related($accounts,"solution_architect_c"))

The SA DOES appear during opportuntiy creation, but is erased when saving the opportunity.

How can I prevent this ?

My next step I planned was to create a User module based related field (Opportunity Solution Architect) on the opportunity and take the above mentioned field as default.

The ini field will stay hidden, The Opportunity Solution Architect field will be shown.

Am I on the correct track to achieve this ?

(I only have Studio and BPM available, PHP and the like is beyond my expertise)

Thanks for your assistance,

Hugo

Parents
  • Hi  ,

    You’re very close! The issue you’re hitting is a common one with calculated fields: they recalculate every time the record is saved, which means your solution_architect_ini_c gets overwritten with the current value from the Account — even if the user has updated it manually (technically because they are calculated they are actually not really editable).

    Since you want to:

    • Initialize it once at Opportunity creation,

    • But allow the user to change it afterwards without it being overwritten,

    A calculated field won’t work here.

    Best approach with Studio & BPM only:

    1. Move the formula from solution_architect_ini_c to solution_architect_ini_default_c and make solution_architect_ini_c a regular text (or related) field.

    2. Create a BPM Process Definition that:

      • Triggers only on new Opportunity creation,

      • Uses Start Event > Change Condition > New Records Only,

      • Add an Action > Change Field to set solution_architect_ini_c with: solution_architect_ini_default_c

      • This copies the value from Account only once at creation.

    Edit: I initially overlooked the core issue — just updated my response to reflect that.

    If you had file-level access, you could define the default field as non-db, which avoids storing it in the database at all — ideal for purely transient values.

    But considering your current access (Studio + BPM only), the BPM-driven copy approach from a calculated helper field is probably the cleanest option.

    — Tev

  • Thanks   for your swift reply.

    Tev, what I don't understand though is , that in my original setup , when creating a new opportunity the solution_architect_ini _c field shows the SA from Account (like intended) , but when saving that field is not overwritten with the re-read current Account SA (like you explained above)  but gets simply blanked/emptied. It would not harm my setup if it would catch the Account SA during creation and again during saving. 

    Also, what is the SugarCRM system 'timing' between recalculating fields and executing a BPM proces with trigger 'new record' ? What comes first ?

    Again, thanks for your help, I'll try your suggestion.

    :-)

    Hugo

Reply
  • Thanks   for your swift reply.

    Tev, what I don't understand though is , that in my original setup , when creating a new opportunity the solution_architect_ini _c field shows the SA from Account (like intended) , but when saving that field is not overwritten with the re-read current Account SA (like you explained above)  but gets simply blanked/emptied. It would not harm my setup if it would catch the Account SA during creation and again during saving. 

    Also, what is the SugarCRM system 'timing' between recalculating fields and executing a BPM proces with trigger 'new record' ? What comes first ?

    Again, thanks for your help, I'll try your suggestion.

    :-)

    Hugo

Children
No Data