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

Notifications

Announcements

No record found.

Community site session details

Community site session details

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

infolog buffer should not reset in try...catch statement per iteration

(0) ShareShare
ReportReport
Posted on by 678

Hi All,

I have an issue that the infolog buffer is totally reset so that error details already cumulated for records processed earlier (purchLine.update()) via a set enumerator are lost after iterating next records which confirm PurchTable records not only updating line details.  If I dont want to lose those error details stacked but show these to users, what shoud we do? 

Thank you.

I have the same question (0)
  • Martin Dráb Profile Picture
    237,878 Most Valuable Professional on at

    This thread is missing context, therefore let me add it. More details can be found in this thread: how to call another method in a 'try' block in case an exception is thrown inside a transaction.

    Especially:

    I found that a block of code which reconfirms the PO after purchLine.update() causes the reset of the infolog and therefore, I will have to take a copy of the infolog before hitting this reconfirming-code and add it again after this reconfirmation of PO is done.

    Is there a way to set the infolog caught in catch block and get it when I want it?

  • Suggested answer
    Martin Dráb Profile Picture
    237,878 Most Valuable Professional on at

    You can copy data from infolog to your own variable, run the process and put message back from your variable to infolog.

    For example, look at How can we get text from infolog ?.

  • ShawnDEV Profile Picture
    678 on at

    Hi,

    I managed to copy infolog data to my own variable 'log' before the process of reconfirming PO which resets the infolog buffer.

    how should I write the code to put the stored infolog data back to the infolog?

    setPrefix('Result');
    while (enumerator.moveNext())
    {
    	try
    	{
    		ttsbegin;
    		setPrefix(strFmt("PO: %1",purchLine.PurchId));
    		...
    		purchLine.update()
            if(purchLine.purchTable().DocumentState != VersioningDocumentState::Confirmed)
            {
    			// copy data from infolog to my own variable 'log'
    			log = infolog.copy(1,infolog.num()); 
    		    PurchFormLetter::construct(DocumentStatus::ConfirmationRequest).update(purchLine.purchTable(),''); 
    			//here I need to put the stored 'log' back to infolog ? how?
    		}
    		ttscommit;
    	}
    	catch
    	{
    	}
    }

    Thank you. 

  • Martin Dráb Profile Picture
    237,878 Most Valuable Professional on at

    Please open the link I gave you above and read the last reply.

  • Suggested answer
    ergun sahin Profile Picture
    8,826 Moderator on at

    Actually, I shared the same link a few days ago, but I guess you didn't pay attention. As in the link, 

    -SysInfologEnumerator::newData(infolog.copy(fromLine, toLine))
    you can insert values to an enumerator, and then using;
    -infolog.add
    you can add it back to the infolog 

    The truth is, I don't understand why you wanted to add copy to the infolog. Copy will not reset the current infolog. From what I saw on your the other thread, you were the one who emptied the infolog (with infologData)

    Do system classes clear infolog?

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 646 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 285 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans