web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested answer

How to handle server methods in D365

(0) ShareShare
ReportReport
Posted on by 239

Hello All,

I am using a standard class in my code but this class need System admin role to use it, if you don't have System admin the method will jump to the "catch" statement and give you the error written there . The class name "DocuTemplateRender" method renderTemplateToStream ,so my question how I can add this class and method to a security role in D365 FF&O.

Any help would be appreciated 

Thanks 

Maen.M

I have the same question (0)
  • ergun sahin Profile Picture
    8,816 Moderator on at
    RE: How to handle server methods in D365

    I can't be considered an expert when it comes to security, but if I'm not mistaken, you can't add classes to privilage in 365. You should be able to add your Class's menuItem.

  • Suggested answer
    OsmanIstanbul Profile Picture
    2,816 on at
    RE: How to handle server methods in D365

    Hi,

    you can add your method on aot, navigate to AOT node at Security > Privileges > YourPrivilege > Permissions > Server Methods > YourServerMethod.,

    Best Regards.

  • Maen.Moutaz Profile Picture
    239 on at
    RE: How to handle server methods in D365

    Hi Ergün Şahin,

    You mean add the class to a menuitem then add it the privilege, because this class don't have menuitem.  

  • Maen.Moutaz Profile Picture
    239 on at
    RE: How to handle server methods in D365

    Hi Osman Akgündüz ,

    this can be done in AX2012 I'm using D365 FF&O there is no server methods in it

  • OsmanIstanbul Profile Picture
    2,816 on at
    RE: How to handle server methods in D365

    Hi,

    Did you try to add it as a reference to the security key?

    pastedimage1621244033740v1.png

  • Suggested answer
    ergun sahin Profile Picture
    8,816 Moderator on at
    RE: How to handle server methods in D365

    I don't think the error was caused by the Class itself. Can you share the error?

    If I remember correctly, many of the methods of this class were using the DocuTemplate table. The error may be caused by this table.

  • Suggested answer
    OsmanIstanbul Profile Picture
    2,816 on at
    RE: How to handle server methods in D365

    As Ergun mentioned you must add your class to an action menu item then add to the key on the above screen.

  • Suggested answer
    Dynamics Community 101 Profile Picture
    on at
    RE: How to handle server methods in D365

    Hi Ma'en Moutaz,

    As Osman mentioned, you must create an action menu item for the class than add that menu item to the privileges

    and than add that privilege to the desired role.

    Regards,

    Atul Yadav

    dynamicscommunity101.blogspot.com

  • Maen.Moutaz Profile Picture
    239 on at
    RE: How to handle server methods in D365

    Dear Osman Akgündüz and Ergün Şahin

    I have tried the service operation with no luck

    and i have tried to add the class to actionmenu item but i got error on build that this class doesn't contain "Main" method

    Also i have tried adding the DocuTemplate table to the privilege  no luck .

    Ergün  the error is from the catch in my method.

  • ergun sahin Profile Picture
    8,816 Moderator on at
    RE: How to handle server methods in D365

    Since it is not called from the Class menuItem, there is no logic to make a new menuItem.

    As I have already written, I don't think the issue is about the security of the class. These classes contain many structures that will require authorization. It is difficult to say anything for sure, because you do not share the error you received, and the codes you received the error.

    If the error seems meaningless, you can check it with Debug or check why it fell into catch in the code.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Mansi Soni – Community Spotlight

We are honored to recognize Mansi Soni as our August 2025 Community…

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans