How to Write a report to copy all customers from one company to another company?

How to write



report to copy all customers from one company to another company?



please help me/…

hi veera,

you need to be more specific then this dear, like do you want a report or form with a button?

in what structure do you want your output?

there is a properity called ‘copy’ which will copy a table record.

do you have 2 companies?

hi,

You have to create a report with one dataitem based on customer’s table. create a global variable based on sames table (named “Cutomer2”)

In the OnAfterGetRecord Trigger put code as:
Customer2.changecompany(Company2Name);
Customer2.init;
Customer2.transferfields(Customer);
Customer2.insert;

And that’s all.

Good luck

Hi Mr.rafaa,

if u dont mind can u explain it.it is asking about changecompany variable and Company2name.

[:^)]

I think that if you do not understand what b.rafaa writes, then you should not go into that operation…

I agree. If you just copied that code and expected it to work then you shouldn’t be doing this. Get in touch with your NAV Partner.

Create a report with a dataitem for table 18 “Customer”,
an input field for the new company name in the request form and a record variable Customer2 for the Customer table.
In the OnAfterGetRecord Trigger write :

Customer2.COPY(Customer);
Customer.CHANGECOMPANY(NewCompany);
IF NOT Customer2.INSERT(TRUE) THEN
Customer2.MODIFY(TRUE);