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);
Dave Treanor
Dynamics Nav Add-onswww.simplydynamics.ie/Addons.html
Please:1. Use a meaningful title.2. Give as much detail as possible.3."Verify Solution" to the post that help you solve your problem.4. Fill out your Tags - it will help other people.5. N.B. Don't be afraid to ask - we all had to learn and are still learning
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