primary key values for a current record

ameramer Member Posts: 22
Hello,

is there any simple way to get a text containing primary key field names and values for a current record?
(e.g. TESTFIELD function displays such a message so you always know which record in a table has caused an error)

Regards,
Amer

Answers

  • garakgarak Member Posts: 3,263
    amer wrote:
    Hello,

    is there any simple way to get a text containing primary key field names and values for a current record?
    (e.g. TESTFIELD function displays such a message so you always know which record in a table has caused an error)

    Regards,
    Amer

    What do you want to do?
    Do you make it right, it works too!
  • ameramer Member Posts: 22
    garak wrote:
    What do you want to do?
    In short, to inform user which row caused an error.
    ( Like I said, TESTFIELD is the example: I do not have to know what are the key fields of a table, NAV will display it to user automatically)
  • navmukeshnavmukesh Member Posts: 12
    Hi,

    Customer.FIELDERROR("No.", 'is not valid');
    This error message appears:
    No. is not valid in Customer No.='NEW 3500'

    Regards
  • Slawek_GuzekSlawek_Guzek Member Posts: 1,690
    From NAV help:

    GETPOSITION (Record)

    Use this function to return a string that contains the primary key of the current record.
    Slawek Guzek
    Dynamics NAV, MS SQL Server, Wherescape RED;
    PRINCE2 Practitioner - License GR657010572SG
    GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
  • ameramer Member Posts: 22
    It seems that GETPOSITION is exactly what I was looking for.

    Thank you all!

    Regards,
    Amer
Sign In or Register to comment.