Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 Community / Forums / Finance forum / Form fields calculation
Finance forum
Suggested answer

Form fields calculation

Posted on by 386
Hi, on my customized form, i have 2 tabs, quotation line and quotation lines details, i want the sum of the field Unit price to show on the total amount. also note that each field is in different data source. how this can be done ? where and which method should be overrided?
 
  • D365FO DEV Profile Picture
    D365FO DEV 386 on at
    Form fields calculation
    Hi @Mohamed,
     
    One issue is that i need to auto refresh the page, so  the total amount gets updated.
    i created a display method on the table, then attached this method on the field total amount on the form level under data method.
    calculation is correct but the total amount is not getting updated if i do not refresh the page.
    why?
  • Suggested answer
    Mohamed Amine Mahmoudi Profile Picture
    Mohamed Amine Mahmoudi 9,332 Super User 2024 Season 2 on at
    Form fields calculation
    Hi @D365FO ERP Developer,
     
    You must use a Display Method to calculate the total amount based on unit price.
     
    e.g.
    public display Name TotalAmount()
    {
        Table   table;
        select sum(UnitPrice) from table where ...
        return table.UnitPrice;
    }
     
    Best regards,
    Mohamed
  • D365FO DEV Profile Picture
    D365FO DEV 386 on at
    Form fields calculation
    hi Layan,
     
    thanks for your reply.
    the total amount field is of type Real.
    also theres no init method to override neither on the table nor form level.
    theres the init value method. 
  • Suggested answer
    Layan Jwei Profile Picture
    Layan Jwei 7,094 Super User 2024 Season 2 on at
    D365FO Form fields calculation
    Hi D365FO developer,
     
    What is the type of total amount, is it display method or field?
     
    If it's a normal field:
    When you first open the form, you would like to see the sum of unit price, so you need to override the init method and calculate the sum for unit price lines
     
    You also would like the total amount to be amended whenever someone changes the unit price, so you need to override the modified method of unit price to recalculate the total amount
     
    Thanks,
    Layan Jweihan
    Please mark this answer as "Verified" if it solved your issue. In order to help others who will face a similar issue in the future

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

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,556 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,625 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans