Usage of RECORDID and GETRECORD

ta5ta5 Member Posts: 1,164
I have a kind of Log table. The idea is to keep that generic, so when I want to log something from a given record, I use a RECORDID.
In another place I want to retrieve the logged record, in the example this would be a given Contact. For that, I use GETRECORD.
But something does not work here. When using the record with MESSAGE, all fields but the key fields are empty.
Any ideas?
Thanks in advance
Thomas
// Writing the Log for a Contact Record
myRecRef.GETTABLE(Contact)
myLog.RecordDetails := myRecRef.RECORDID; //saving the reference for a given Contact record

// Reading the Log
...
myRecID := myLog.RecordDetails ;
MyRecRef := myRecID.GETRECORD;
MESSAGE('FIELD 1\Field  2 %2',MyRecRef.FIELD(1).VALUE,MyRecRef.FIELD(2).VALUE);

Best Answers

Answers

  • SillysodSillysod Member Posts: 4
    I believe you just need to add MyRecRef.FINDFIRST, that should populate the record.
  • NavNabNavNab Member Posts: 181
    Hi @ta5,

    Which NAV version you're using?
  • ta5ta5 Member Posts: 1,164
    Thanks for commenting.
    FINDFIRST does not help, unfortunately.
    I use NAV 2013R2.
    Any other ideas? Would be great!
  • ta5ta5 Member Posts: 1,164
    Hello Nabil and John
    GET did the trick. Thanks a lot. I was not aware of that kind of usage of the GET command.
    Thanks again, you made my day!
    Thomas
Sign In or Register to comment.