You must use RecordVariable.GET(Field1Value) to that the desired record. The number of values which go inside the GET function are the number of fields in the Primary key of the RecordVariable's table.
If you have more fields in the primary key, but you want to search on just one of these values, than you cannot use GET
In that case use SETFILTER or SETRANGE, and then FINDFIRST/FINDSET/FINDLAST.
Example for table 36 'Sales Header' that has 2 fields as primary key: "Document Type" and "No.". Now if you know the document number, like 'SO-W001' you could write:
SalesHeader.SETRANGE("No.", 'SO-W001');
IF SalesHeader.FINDFIRST THEN
MESSAGE ('%1 has document type %2',SalesHeader."No.",SalesHeader."Document Type");
Answers
Note that a table can have only one primary key.
Please check this https://msdn.microsoft.com/en-us/library/dd301056(v=nav.90).aspx to get more knowledge on GET function.
Ishwar Sharma
My Blogs: Dynamics Community Blog | Blogspot
Connect: Google + | Twitter
https://msdn.microsoft.com/en-us/library/dd338755.aspx
Archerpoint India Pvt. Ltd,Chennai.
Like - Item.GET(SalesLine."No.");
Blog - rockwithnav.wordpress.com/
Twitter - https://twitter.com/RockwithNav
Facebook - https://facebook.com/rockwithnav/
but a primary key can be made up of more than one field, right?
In that case use SETFILTER or SETRANGE, and then FINDFIRST/FINDSET/FINDLAST.
Example for table 36 'Sales Header' that has 2 fields as primary key: "Document Type" and "No.". Now if you know the document number, like 'SO-W001' you could write: