Skip to main content


Showing posts from June, 2013

Record level security (AX 2009)

Hi, Let me walk-through how we can create record level security through code.
When you create record level security from front end, sometimes wizard doesn't show you the exact form or I can say it doesn't capture the actual table query.
So in that case for some tables or form, we can write the job in AOT and executing it results in creating record in record level security form.
static void RecordLevelSecurityEx(Args _args) {     Query                   q;     SysQueryRun             queryRun;     sysRecordLevelSecurity  sysRecordLevelSecurity,sysRecordLevelSecurity_old;     ;
    q = new Query();
    q.addDataSource(tablenum(SalesQuotationTable));     SysQuery::findOrCreateRange(q.dataSourceNo(1),fieldnum(SalesQuotationTable,Createdby)).value('Admin');
    queryRun    =   new SysQueryRun(q);
    // Need to have a RecordSortList and insert will happen for one time only, loop of companies is needed     sysRecordLevelSecurity.clear();     sysRecordLevelSecurity.TabId        =   1967;    …