Sunday, March 25, 2012

"unchecked" Keyword in AX 2009


There is a keyword in X++ named unchecked that if used together with the uncheck::TableSecurityPermission enum value allows to turn off the effect of AosAuthorization for a specific code block.


This is used to turn off the security permission for a user whenever the data is inserted into a table using business logic.
 unchecked(uncheck::TableSeurityPermission)
   {
      object.insert();
   } 



You can also find this code in AX 2009 in some of the classes.For example,
Goto Classes --->LedgerTransferOpening--->insertClosingTrans(),you can find the below piece of code in the last line.



// allow any user to insert by turning security permissions off
            unchecked(Uncheck::TableSecurityPermission)
            {
                ledgerTrans.insert();
            }













1 comment:

  1. 4 years later and you just saved the day for me :) Thanks. For some reason AX2009 seems to require developer access to do ledger check payment reversals.

    ReplyDelete