Hi All,
Can anyone explain me on this create all customers as employees can we do this in AL and is there any reference for how to create all customers as employess if anyone knows help me.
Thank you.
Hi All,
Can anyone explain me on this create all customers as employees can we do this in AL and is there any reference for how to create all customers as employess if anyone knows help me.
Thank you.
DataItem Customer
Var
CheckEmployee : record Employee
InsertEmployee : record Employee
OnAfterRecord
Begin
if CheckEmployee.get(Customer."No.") then begin
CheckEmployee.First Name := Customer.Name;
CheckEmployee.Modify;
end else begin
InsertEmployee.Init;
InsertEmployee.."No." := Customer."No.";
InsertEmployee.Insert;
InsertEmployee.First Name := Customer.Name;
InsertEmployee.Modify;
end;
end;
Regards
Amit Sharma
Good to know
Hi Nithin,
Thank You Nithin it worked for me.
Thanks.
Please do as per below now I have removed customer variable
report 50101 Process
{
UsageCategory = ReportsAndAnalysis;
ApplicationArea = All;
ProcessingOnly = true;
dataset
{
dataitem(Customer; Customer)
{
RequestFilterFields = "No.", Name;
column(Name; Name)
{
}
trigger OnAfterGetRecord()
var
Employee: Record Employee;
begin
IF Not Employee.GET(Customer."No.") THEN BEGIN
Employee.INIT();
Employee."No." := customer."No.";
Employee.INSERT();
Employee."First Name" := Customer.Name;
Employee.Address := Customer.Address;
Employee."Address 2" := customer."Address 2";
Employee.City := customer.City;
Employee."E-Mail" := customer."E-Mail";
Employee.Modify();
end;
end;
}
}
requestpage
{
layout
{
area(Content)
{
group(GroupName)
{
// field(Name; SourceExpression)
// {
// ApplicationArea = All;
// }
}
}
}
actions
{
area(processing)
{
action(ActionName)
{
ApplicationArea = All;
}
}
}
}
}
Hi Nitin,
I am sharing my whole code
report 50101 Process
{
UsageCategory = ReportsAndAnalysis;
ApplicationArea = All;
ProcessingOnly = true;
dataset
{
dataitem(Customer; Customer)
{
RequestFilterFields = "No.", Name;
column(Name; Name)
{
}
trigger OnAfterGetRecord()
var
Customer: Record Customer;
Employee: Record Employee;
begin
IF Not Employee.GET(Customer."No.") THEN BEGIN
Employee.INIT();
Employee."No." := customer."No.";
Employee.INSERT();
Employee."First Name" := Customer.Name;
Employee.Address := Customer.Address;
Employee."Address 2" := customer."Address 2";
Employee.City := customer.City;
Employee."E-Mail" := customer."E-Mail";
Employee.Modify();
end;
end;
}
}
requestpage
{
layout
{
area(Content)
{
group(GroupName)
{
// field(Name; SourceExpression)
// {
// ApplicationArea = All;
// }
}
}
}
actions
{
area(processing)
{
action(ActionName)
{
ApplicationArea = All;
}
}
}
}
}
Can you check it.
Share complete report code
Hi Nitin
In the proccessinonly Report I am doing this.
Also show your report filters if any
Hi All,
I have wrote the code in the report for creating all customers as employess but my code is not working can anyone will help me. I am attaching the code of look at it and guide me guys
trigger OnAfterGetRecord()
var
Customer: Record Customer;
Employee: Record Employee;
begin
IF Not Employee.GET(Customer."No.") THEN BEGIN
Employee.INIT();
Employee."No." := customer."No.";
Employee.INSERT();
END;
Employee."First Name" := Customer.Name;
Employee.Address := Customer.Address;
Employee."Address 2" := customer."Address 2";
Employee.City := customer.City;
Employee."E-Mail" := customer."E-Mail";
Employee.Modify();
end;
Thanks & Regards
P V Sarath.
Hi All,
I have wrote the code in the report for creating all customers as employess but my code is not working can anyone will help me. I am attaching the code of look at it and guide me guys
trigger OnAfterGetRecord()
var
Customer: Record Customer;
Employee: Record Employee;
begin
IF Not Employee.GET(Customer."No.") THEN BEGIN
Employee.INIT();
Employee."No." := customer."No.";
Employee.INSERT();
END;
Employee."First Name" := Customer.Name;
Employee.Address := Customer.Address;
Employee."Address 2" := customer."Address 2";
Employee.City := customer.City;
Employee."E-Mail" := customer."E-Mail";
Employee.Modify();
end;
Thanks & Regards
P V Sarath.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 290,537 Super User 2024 Season 2
Martin Dráb 228,520 Most Valuable Professional
nmaenpaa 101,148