Hi,
I have to do some coding in an OnModify trigger of a table. Is there a function or a variable I can use to get the ID of the appropriate table ?
I also want to make a function in a codeunit which will use FieldRef to return all field names of a table. This function will be called by an external COM-application.
My second question is: Should I use Table Name or Table ID as parameter to call this function (which change not or maybe less) ? The problem is, if a table will be renumbered or renamed, my external application will no longer be able to get the field names (the function won't find the table).
Best Regards,
navvy
navvy
Freelance Developer
0
Comments
-The best way is to use the table ID. There is less change someone changes the ID of an object. The name can be easily changed in NAV without any problems.
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
Thanks for the help What do you mean with "But I would just use DATABASE:"Your Table" to have the ID. ", where should I use this ?
Last question: Is it possible to track renumbering of tables e.g. is there a certain trigger which I can use ?
navvy
Freelance Developer
Table ID: If you use RecordRef, you can use the recref.NUMBER to get the ID of the table. And how to create RecRef from Record you know... ;-)
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
Give this a try:
So DATABASE::"Sales Line" is like an integer constant and is more readable than 37.
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
where RecRef is a local variable of RecordRef type...
Slawek.
EDIT:
Oops... Kine already suggested this
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
http://vjeko.com/blog/detecting-current ... et-interop
http://vjeko.com/
"In C# you can easily get access to the current method, or the method that called the current method"
Now - can you do THIS in NAV ?
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
Vjeko did this in NAV using dotnet interop. Just look at his blog and the downloadable objects.
Excellent solution.
Gunnar Gestsson
Microsoft Certified IT Professional
Dynamics NAV MVP
http://www.dynamics.is
http://Objects4NAV.com
Ahhh.. haven't looked in attached code samples..... :oops:
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.