Skip to main content

Notifications

Community site session details

Community site session details

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

how to transfer data from our own table to customer table and modify

(0) ShareShare
ReportReport
Posted on by 151

hello,

I have created one table and import data in it with csv file now I want to pass that information to customer table, sales line table and sales header table in such way that if my client code is there then the data is modified or not then data should be inserted as well as if I made some change in my table then it automatically change in others table. I tried some code but data is not modifying in customer table it inserting data only. If I made some change in my table then it not get update in other below is my code.

codeunit 50120 "My table codeunit"

{

    procedure Process()

    var

        mycodeunit: Record "My table";

        customer: Record Customer;

    begin

        InsuranceInterface.Reset();

        customer.Reset();

        repeat

            if not customer.get(mycodeunit."Client Code ") then begin

                customer.Init();

                customer."No." := mycodeunit."Client Code ";

                customer.Address := mycodeunit.Address;

                customer."Address 2" := mycodeunit."Address 2";

                customer.City := mycodeunit.City;

                customer."Post Code" := mycodeunit."Post-Code";

                customer."Phone No." := mycodeunit."Tel. No";

                customer."E-Mail" := mycodeunit."Email Address";

                customer.Insert(true);

            end

            else begin

               

                customer.Name := mycodeunit.Name;

                customer.Address := mycodeunit.Address;

                customer."Address 2" := mycodeunit."Address 2";

                customer.City := mycodeunit.City;

                customer."Post Code" := mycodeunit."Post-Code";

                customer."Phone No." := mycodeunit."Tel. No";

                customer."E-Mail" := mycodeunit."Email Address";

                customer.Modify(true);

            end;

        until

         mycodeunit.Next() = 0;

    end;

}

and code on page is

 action(process)

            {

                Image = Process;

                ApplicationArea = all;

                Promoted = true;

                PromotedCategory = Process;

                PromotedIsBig = true;

                trigger OnAction()

                var

                    mytableProcess: Codeunit "My table codeunit"

                begin

                    mytableProcess.Process();

                    rec."Processed By UserID" := UserId;

                    rec."DateTime Processed" := CurrentDateTime;




                end;

help me regard this if anybody can.

  • Suggested answer
    Alok.kulshreshtha Profile Picture
    934 on at
    RE: how to transfer data from our own table to customer table and modify

    Hi Salba,

    Add IF mycodeunit.FINDSET THEN  above to Repeat and try.

    Regards

    Alok Kulshreshtha

    Please Verify my answer if you find my post helpful.

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

Jainam Kothari – Community Spotlight

We are honored to recognize Jainam Kothari as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

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

#1
Sohail Ahmed Profile Picture

Sohail Ahmed 1,452

#2
YUN ZHU Profile Picture

YUN ZHU 1,313 Super User 2025 Season 1

#3
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 1,083 Most Valuable Professional

Featured topics

Product updates

Dynamics 365 release plans