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...
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

    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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the August Top 10 Community Leaders

These are the community rock stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 739 Super User 2026 Season 2

#2
YUN ZHU Profile Picture

YUN ZHU 462 Super User 2026 Season 2

#3
AndrewThomas81 Profile Picture

AndrewThomas81 406 Super User 2026 Season 2

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans