RENAME - code problem

I am trying to change the “No.” in the posted sales invoice.

IF InvHead.GET(OldDocNo) THEN
InvHead.RENAME(OldDocNo,NewDocNo);

I obviously do not understand the example in the Nav help.

I get the error “Too many key fields were specified, so Sales Invoice Header could not be retrieved. The number of fields in the primary key is 1.”

Does this mean I am not able to write a non-printing report and change a primary key or is my code rubbish?

Thanks in advance,

Colin

Hi Colin,

The RENAME function work by finding a record and then using the RENAME to insert the new primary key. Each parameter equates to a field on the primary key. In your example it’s

InvHead.RENAME(NewDocNo);

Thanks…so simple. Wonder why they don’t say that in the help text?

Yes I agree the help in this case is confusing.

Glad to Help [:D]