web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested Answer

How to save all records to recalculate values

(0) ShareShare
ReportReport
Posted on by 95

I have a problem. I have modified to calculate some fields in an form, they are only calculate when I open and save a record.

 Form include Fields with:

Calculated type.

Simple type: calculated by JavaScript when user load and save form.

How can I recalculate for all old records without open and save form? values will recalculate/display in views correctly.

Is there any batch job to do that?

Thanks.

I have the same question (0)
  • Shweta_Shukla Profile Picture
    107 on at

    Have you tried editing the records in bulk? Does it reflect the modified value?

    • If not, you can create a temporary field,
    • add it on form. Publish.
    • on entity's view, bulk edit records and modify that temporary field
    • Check if the calculated fields have been modified?

    I believe the fields are calculated and not rollups, rollups fields are usually auto-calculated in 12 hours, you can shorten it down to modify it in 1 hour or you can write plug-ins to refresh it on some trigger.

  • Suggested answer
    David Yu Profile Picture
    on at

    Hi,

    Calculated fields are computed on database level, and they are automaticaly updated on views and forms. We don't need to recalculate that information.

    But if you want to recalculate your rollup fields, you may need use CalculateRollupFieldRequest.

    docs.microsoft.com/.../microsoft.crm.sdk.messages.calculaterollupfieldrequest

    Here is a good blog about the difference.

    community.dynamics.com/.../dynamics-crm-calculation-amp-rollup-fields

  • baochau Profile Picture
    95 on at

    How is the simple field calculated by javascript when form load and save ? it's calculated auto?

  • Shweta_Shukla Profile Picture
    107 on at

    Firstly, can you confirm what is the datatype of that fields that you want to modify? If you can send the screenshot of that field that'll be ideal.

  • baochau Profile Picture
    95 on at

    Data type: currency

    Field type: Simple

    The field is calculated in JavaScript (form load and save event)

    20200525212659.jpg

  • Shweta_Shukla Profile Picture
    107 on at

    As it is a simple field, you can make use of your JavaScript function to trigger it on change of your temporary field,

    • If not, you can create a temporary field,
    • add it on form. Register your JavaScript function onChange of this field. Publish.
    • on entity's view, select all older records, perform bulk edit records (click on edit button on ribbon menu after you select records) and modify that temporary field
    • Check if the calculated fields have been modified?
    • If so, remove the temporary field from form.

    Mark answer as verified if it resolved your problem.

  • baochau Profile Picture
    95 on at

    When I open any record and save, this field is calculated. (Execute JavaScript)

    When I check old records in view (list), this field is empty.

    How can I update to calculate old records without open and save form?

  • baochau Profile Picture
    95 on at

    Thanks you, I will try bulk update as you suggestion

  • baochau Profile Picture
    95 on at

    I tried your idea, onChange fired when I open form and change temp field, but when I tried to use bulk update 2 records on view, the event is not fired. The script could be not triggered. Do you have any idea?

  • Shweta_Shukla Profile Picture
    107 on at

    In that case I think JavaScript won't be a correct option to go with.. Can you nit perform the same calculation using Workflow and fire it on-demand for selected records?

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 83 Super User 2025 Season 2

#2
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 49 Most Valuable Professional

#3
#ManoVerse Profile Picture

#ManoVerse 40

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans