Skip to main content

Notifications

Small and medium business | Business Central, N...
Answered

How to add a value from a custom field to an existing field

(0) ShareShare
ReportReport
Posted on by 382

Hey everyone, 

I have created a custom field into an existing table. I want that whenever a value is inserted to the custom field, the same value should be inserted into one of the specified existing field. Like for example in the figure below, for a specific "No." when "Net change" is 749259.10  then "Budgeted Amount" should also become 749259.10. Remember, I don't want it for the entire column but for a specific "No.". Kindly address my concern. Thank you.

pastedimage1669885944459v1.png

  • RE: How to add a value from a custom field to an existing field

    Ok. Thanks all for the answers.

  • Sejal Profile Picture
    Sejal 95 on at
    RE: How to add a value from a custom field to an existing field

    Hello,

    You Modify "Net Change" field

    Try below code,

    Modify("Net Change")

    {

           trigger OnAfterValidate()

          var

         begin

         rec."Budgeted Amount" := Rec."Net Change";

         End;

    }

    Thanks

  • Verified answer
    YUN ZHU Profile Picture
    YUN ZHU 74,036 Super User 2024 Season 2 on at
    RE: How to add a value from a custom field to an existing field

    No, this is not possible.

    FlowFields are not physical fields that are stored in the database. 

    https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/devenv-flowfields

    pastedimage1669941667763v1.png

  • RE: How to add a value from a custom field to an existing field

    Is there any way to add a custom value in a flow field?

  • Suggested answer
    Nitin Verma Profile Picture
    Nitin Verma 21,091 Super User 2024 Season 1 on at
    RE: How to add a value from a custom field to an existing field

    Hi,

    You can not assign any value to or from of those fields as those fields are Flowfields in the table. Also if you want to you can introduce your custom field and do the following

    Rec.calcfields("net Change");

    Custfield := Rec."Net Change";

    This is an idea but use calcfields for fields.

    Thanks.

  • RE: How to add a value from a custom field to an existing field

    it is not working. I have attached the screenshots. You can validate whether it is correct or not and if not then provide me with your code. The EventSubscriber must be in code that's why I have created one. Thank you.

    pastedimage1669891992199v1.png

    pastedimage1669892009606v2.png

  • Suggested answer
    DAnny3211 Profile Picture
    DAnny3211 9,272 Super User 2024 Season 1 on at
    RE: How to add a value from a custom field to an existing field
    Hi
    hook into the onbeforeValidate event of the Net Change field and insert the following code:
     [EventSubscriber(ObjectType::Table, yourtable, 'OnBeforeValidateEvent', 'Net Change', false, false)]
        local procedure fsfd(var Rec: Record yourtable)
        begin
           rec.Budgeted Amount:=rec.Net Change;
        end;
    check my answer if it helped you, thanks
    DAniele

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

News and Announcements

Announcing Category Subscriptions!

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 Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,370 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans