Skip to main content

Notifications

Community site session details

Community site session details

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

How to send infolog messages / errors from C# in F&O?

(0) ShareShare
ReportReport
Posted on by 20

Hello,

I’m calling an API from C#, and I need to display the authentication error, or any other error from the service.

I want to send the error to the client like this

Error(“Authentication error”);

But from C#. Just want something like an info message but from C# to the client in Dynamics.

How can I achieve this? Console.WriteLine wasn’t useful for me.

  • Martin Dráb Profile Picture
    232,866 Most Valuable Professional on at
    RE: How to send infolog messages / errors from C# in F&O?

    Can you show us a screenshot, please?

    You forgot to mention whether the exception is caught or not. Use the debugger to find the information, if you haven't tried to debug your code yet.

    How do you execute your code? Through SysOperation framework, for example?

  • ntorres Profile Picture
    20 on at
    RE: How to send infolog messages / errors from C# in F&O?

    Hi Martin, thanks for replying.

    I created a C# project and added the reference in my F&O project.

    Now I am throwing an exception in C# like this: 

    throw new Exception(“Error in request.”);

    .

    And I want to show that specific message in F&O, I’m doing it like this:

    System.Exception ex;

    /////rest of the code

    catch(ex)
    {

          throw error(ex.Message);

    }


    But in the infolog shows “One or more errors occurred” instead of my custom message.

    How can I display the custom exception from C# in F&O?

    Thanks.

  • Martin Dráb Profile Picture
    232,866 Most Valuable Professional on at
    RE: How to send infolog messages / errors from C# in F&O?

    Please tell us more about your architecture. You mentioned that you have something written in C#, but it's not how it's related to F&O.

    If you have a C# library that you use directly in F&O through .NET Interop, unhandled exceptions propagates to F&O and are displayed to users, or they can be handled in X++.

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 294,095 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,866 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Product updates

Dynamics 365 release plans