Skip to main content

Notifications

Announcements

No record found.

Customer experience | Sales, Customer Insights,...
Answered

Calculated fields and onSave Javascript sequence

Posted on by 95

Hi all,

I have an issue about sequence Calculated fields and depend fields that using in onSave even Javascript.

E.g: 

A: Simple Field

B: Simple Field

C: Calculated Field = A + B

D: Simple Field

E: Simple Field

Javascript: OnSave () 

var C = Xrm.Page.getAttribute("C").getValue();

E = C + D

Issue: When I click Save, C always use previous/old value. OnSave event always fire before C is calculated.

Is there anyhow configure Calculated fields are calculate before OnSave event ?

  • baochau Profile Picture
    baochau 95 on at
    RE: Calculated fields and onSave Javascript sequence

    Thanks, I will try use JavaScript the same calculated field.

  • Verified answer
    Bipin D365 Profile Picture
    Bipin D365 28,964 Super User 2024 Season 1 on at
    RE: Calculated fields and onSave Javascript sequence

    Hi,

    What I understand from various threads is that calculated fields are real-time. However, instead of real-time, these seem to happen upon save and not when the inputs are made available.

    real-time for calculated fields mean after the record is saved and in the same transaction, not when the input fields of the calculated field changes before the saving.

    you can write a javascript that does the same as the calculated field, without knowing exactly what are you doing is difficult to provide a different way

    You can also perform the same operation in plugin code instead of using Javascript.

    See below article for more information.

    www.crmconsultants.co.uk/.../

    If found helpful, Please mark my answer verified.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans