RecordRef - current RecordRef.CompanyName

ichladilichladil Member Posts: 68
Hello,

is there any way I may find the current company for the RecordRef?

In NAV2009 we have new nice triggers in codeunit 1 called OnDatabaseInsert/Modify/Delete/Rename - however these triggers are run with RecordRef reference without the reference to the company where it happens. I.e. the code

Customer.CHANGECOMPANY('AnotherCompany');
Customer.FINDFIRST;
Customer.MODIFY;

will create the integration log in the current company and not in 'AnotherCompany' and at the moment I do not know how to find out which company the RecordRef belongs to.

Any ideas?

Thanks
Igor

Comments

  • einsTeIn.NETeinsTeIn.NET Member Posts: 1,050
    CHANGECOMPANY is only applied to the record variable for which it was called. That means in your example only for Customer, any other read/write command will be executed in the current company.
    "Money is likewise the greatest chance and the greatest scourge of mankind."
  • kinekine Member Posts: 12,562
    I think that because the global triggers are new things, this situation is not handled. You can describe it to the support and request som echange arround this... or go to the NAV TechDays and tell it to the responsible person directly.... ;-)
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • ichladilichladil Member Posts: 68
    Thanks kine! I expected that is the case however I hoped someone have better news :). Igor
Sign In or Register to comment.