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

Function Info() vs Infolog.add()

(0) ShareShare
ReportReport
Posted on by 552

Hello guys,

Being beginner in F&O development, may I request some advice. If using Info("textMessage") will instantly show the message in the UI, what is the different if we're using Infolog.add() ? and how exactly using it ?

I'm creating a function which having process flow something like this : Processsing TempTable data -> create Sales Order -> Create Sales Invoice. 

While I'm create this in a transaction block (ttsbegin....ttscommit), currently ata each process I'm using Info() to inform the step, for example when Sales Order created, I inform "Sales Order number 999 has been created", etc. 

Issue is, if there is error along the way, for example posting invoice failed, this transactions will roll-back, which is the way I expected. But in the UI looks weird (and misleading) since there was a message (information) saying Sales Order xxx has been created while in reality it is not because it is rolled back.

May I know how to handle this ? 

I have a catch error handling in the end, since I also put this process under Try..Catch() block, can I use infolog.add() instead, so the info can be hidden first, but if there is an error, I think I want to have an error log saying Sales Order has been created for helping us to identify at least Sales Order process is passed and the error surely after that process. 

Thanks,

I have the same question (0)
  • Suggested answer
    Martin Dráb Profile Picture
    237,668 Most Valuable Professional on at
    RE: Function Info() vs Infolog.add()

    info() is a static method defined in Global class. If you open its definition, you'll see what it does - it calls infolog.add(). It's just a shorter way to do the same.

    The other question doesn't match the topic of this thread (Function Info() vs Infolog.add()). I'll answer it, but please create a separate thread next time.

    Messages in infolog aren't a part of a database transaction, therefore a transaction rollback indeed has impact on it. You must remove messages by yourself. You can remember the starting number of messages (infologLine()) and then remove new ones (infolog.clear()).

  • Suggested answer
    Bharani Preetham Peraka Profile Picture
    3,634 Moderator on at
    RE: Function Info() vs Infolog.add()

    But if you have any error, have you tried throw error() ?

  • Ken Manhattan Profile Picture
    552 on at
    RE: Function Info() vs Infolog.add()

    Yes, when there is error, I am execute throw error().

    User will know there is an error at later stage, however the previous message also visible to see, the info(), which user may not know that all preceded process (example : the Sales Order) are not exist because it is rolled back . So I want to know how to handle it correctly to not misleading.

    Thanks.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
Martin Dráb Profile Picture

Martin Dráb 683 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 563 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 398 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans