Hi,
In my app, customers are coded based on their customer type - FINance, RETail, COMmercial, so Customer No. is FIN, RET or COM plus an incrementing number. e.g. FIN-0030
When a user changes the customer type field in a record I need to change the primary key to reflect their new account no. Presently I have the following code in the Customer Type - OnValidate() event on the Customer table :
IF (Rec."Customer Type" <> xRec."Customer Type") THEN BEGIN
// Procedure For Changing Contract Type
// First Rename Account Record
SalesSetup.GET;
SalesSetup.TESTFIELD("Finance Customer Nos.");
NewAccountNo := NoSeriesMgt.GetNextNo(SalesSetup."Finance Customer Nos.", 0D, TRUE);
NewRecordVar.RESET;
NewRecordVar.GET(Rec."No.");
NavResult := NewRecordVar.RENAME(NewAccountNo);
END;
This renames the record ok, but I need the screen to refresh properly and automatically move to the newly recoded record.
Any help appreciated, including any alternative (better) methods of doing this.
Jonathan
0
Comments
RIS Plus, LLC