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.