How to get duties of table using x++ code ..?

Hi All,

Can anyone please tell me how to get all duties related to a table using x++ code.?

For Example,

LedgerJournalTable contains 43 duties…

Have a look at \Classes\SysSecObjectsFromSecurableObject\GenerateData.
This method will be called, when you right click on a table and view security related data.

Hi Kranthi,
Thanks for ur reply…
Is this possible to get Duties from table ‘SecurityTask’ for particular table?..

Security task will contain the list of duties, roles and privileges. You may have to include other security related tables to achieve your requirement.
See the below method for the list of tables to be included in your query.
\Classes\SysSecObjectsFromDuty\GenerateRelatedObjectsData , this method gives the list of objects for a given duty.
Also see this documentation to understand the purpose of different security related tables.…/securableobject.aspx

Hi Kranthi,
The SysSeclattable contains the last accesssed table’s duty information .Can u pls tell me how to prroceed…It is pretty difficult…Because tables are system reated(System documentaion).

Hi Kranthi,
Any other possibilities…

Have you tired my last suggestions?

S…I have tried…

Can you show the code? What problem do yo have?

Hi Kranthi,

pls see this…

static void SK_SecDuty(Args _args)

    SecurityTask privilegesTbl;
    SecurityTaskPermissionOverride secTaskPermissionOverrideTbl;
    SecurableObject secObjectTbl;
    SecurityTask secTaskTbl;
    SecurityTaskExplodedGraph secTaskExplodedGraphTbl;
    SecurityRoleTaskGrant secRoleTaskGrantTbl;
    SecuritySubRole secSubRoleTbl;
    SecurityRole secSubRoles;
    SecurityRole secRoleTbl;
    str dutyAOTNm, dutyNm;
    int64 dutyId;
    str 40 childName = '';

    SysSecFlatDataTable dataTable;

    while select * from secObjectTbl where (secObjectTbl.Name == 'CustTable' && secObjectTbl.Type == 44 && (!childName || secObjectTbl.ChildName == childName))
        join * from secTaskPermissionOverrideTbl where (secTaskPermissionOverrideTbl.SECURABLEOBJECT == secObjectTbl.RECID)
        join * from privilegesTbl where (privilegesTbl.RECID == secTaskPermissionOverrideTbl.SecurityTask)
        outer join SecurityTask, SecuritySubTask from secTaskExplodedGraphTbl where (secTaskExplodedGraphTbl.SecuritySubTask == privilegesTbl.RECID)
        outer join AOTName, Name, Type, Recid from secTaskTbl where (secTaskTbl.RECID == secTaskExplodedGraphTbl.SecurityTask)
        outer join SecurityTask, SecurityRole from secRoleTaskGrantTbl where (secRoleTaskGrantTbl.SecurityTask == secTaskExplodedGraphTbl.SecurityTask)
        outer join SecurityRole, SecuritySubRole from secSubRoleTbl where (secSubRoleTbl.SecuritySubRole == secRoleTaskGrantTbl.SecurityRole)
        outer join AOTname, Name, RecId from secSubRoles where (secSubroles.RecId == secSubRoleTbl.SecuritySubRole)
        outer join AOTName, Name, RecId from secRoleTbl where (secRoleTbl.RecId == secRoleTaskGrantTbl.SecurityRole || secRoleTbl.RecId == secSubRoleTbl.SecurityRole)
        if(secTaskTbl.Type == 1)
            dutyAOTNm = secTaskTbl.AotName;
            dutyNm = secTaskTbl.Name;
            dutyId = secTaskTbl.RecId;



Any changes…

Hi Kranthi,

Thanks for ur suggestions…

Got the answer…

static void SK_SecDuty(Args _args)

    SysSecObjectsFromSecurableObject  obj;
    SysSecFlatDataTable dataTable;
    while select * from dataTable group by Duty
        where dataTable.AccessRight==AccessRight::View


The simpler approach would be to call \Classes\SysSecObjectsFromSecurableObject\GenerateData
and then look through the records of \Data Dictionary\Tables\SysSecFlatDataTable