Options

ID of current object

krikikriki Member, Moderator Posts: 9,096
edited 2009-08-10 in NAV Tips & Tricks
Sometimes it is necessary to have the ID of current object.
If you use record-references, in it you have an function that returns the ID of the table you are using, but it does not exist in codeunits,.... (it DOES exist in REPORTS).

To make it a little easier, it is best to create a function that returns the ID.
If you use it a lot and copy the object to another ID, you just have to change it in that function.

CurrentObjectID() OintCurrentCodeunit : Integer
// CurrentObjectID
// Returns ID of current object
// PARAMETERS:
//   RETURN-VALUE : ID of current object

EXIT(CODEUNIT::"RCD Processing");
Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


Comments

  • Options
    BeliasBelias Member Posts: 2,998
    it is so simple that it took me 5 minutes to understand it...(i mean it's a long time for one line of code) :D
    I couldn't figure out what is the "RCD Processing"...it is only a sample!!! #-o
    Nice, indeed...it makes the code easier to read and to write
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
Sign In or Register to comment.