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).
Martin Dráb 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.