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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Answered

Conditional and divide fields into new field :)

(0) ShareShare
ReportReport
Posted on by 160

Hi mates! :)

I need your wisdom.

I'm trying to create a new field on table and page and the logic is the next one:

CustomAmount = new decimal field.

If currency factor = 0

then CustomAmount = currency factor

if currency factor <> 0

then CustomAmount = Amount/currency factor

I tried the next but didn't work. Any ideas?

Thank you so much :)

[Sorry for my bad english]

   trigger OnOpenPage()
    var
       
    begin
        if rec."Currency Factor" = 0
        then
            rec."CustomAmount" := rec.Amount;

        if rec."Currency Factor" <> 0
        then
            rec."CustomAmount" := rec.Amount / rec."Currency Factor";
    end;
  • Suggested answer
    Nitin Verma Profile Picture
    21,812 Moderator on at

    Hi,

    Please move your code to OnAfterGetRecord trigger instead of OnOpenPage

    Thanks.

  • JMartin Profile Picture
    160 on at

    Thanks mate! :) That worked

  • Suggested answer
    Nitin Verma Profile Picture
    21,812 Moderator on at

    Good to know it helped.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 624 Super User 2026 Season 2

#2
YUN ZHU Profile Picture

YUN ZHU 440 Super User 2026 Season 2

#3
Teagen Boll Profile Picture

Teagen Boll 244 Super User 2026 Season 2

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans