Privileges and Entry Points Related to Duty

Hi Axperts,

Can anyone tell me how to get privileges and entry points related to a duty using x++ code…?

If you know how to do it manually (right-click a duty and select Add-Ins > Security tools > View related security objects), you can look into code to see how Microsoft have done it. You’ll find that it’s handled by SysSecObjectsFromDuty::GenerateData(), which you can either call and process the result, or look at its implementation and write your own code based on it (if you need something else than what the method provides).

Hi All,

Found the answer…

static void SK_PrivilegesForDuty(Args _args)
{
    str 40                  dutyName;
    SysSecFlatDataTable     dataTable;
    SysSecObjectsFromDuty   SecDuty;    
    #Define.dutyName('ACOInquire_BR')
    
    dutyName = #dutyName;
    SysSecObjectsFromDuty::GenerateData(SysSecObjectsAnalyzeType::SecViewRelatedObjects,dutyName);
    
    // Privileges related to the Duty
    while select dataTable group by Privilege
        where dataTable.Duty == dutyName
    {
        info(strFmt('%1 ',dataTable.Privilege));
    }   
    
    //Entry Points Related to the Duty
    while select dataTable group by EntryPoint
        where dataTable.Duty == dutyName
    {
        info(strFmt('%1 ',dataTable.EntryPoint));
    }    
    
}

[mention:64fb33d4ab384f5ebca3050a0d9ca94f:e9ed411860ed4f2ba0265705b8793d05] I want to retrieve a list of permissions associated with a privilege in D365 FO. I cross-referenced and researched a lot but unsuccessful in finding what table holds this information in D365 FO. I was able to do this in AX 2012.

This answered thread is indeed about AX 2012, not D365FO. I suggest you create a new thread (with an appropriate title and tags) and explain your particular requirements there. Don’t forget that you can define security both in metadata at design-time and in the application itself; make sure you explain which case(s) you’re interested in.