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 :
Microsoft Dynamics AX (Archived)

Using try & catch to catch error

(0) ShareShare
ReportReport
Posted on by

I add  the below code  to get financial dimension in a method of a class , the problem is that when the method (findByDimensionAttributeAndValue) throw an error the execution of the code is stopped although I have try have try,  catch

 

 

When I move the logic to a job and execute it  try and catch workers properly , can you please advise what should I do make try catch works in the method to avoid such interruption in the execution ?

 

 

Try

{

dimensionAttributeValue =  dimensionAttributeValue::findByDimensionAttributeAndValue(dimensionAttribute,dimValue,false,true);

 

        valueSetStorage.addItem(dimensionAttributeValue);

 

}

catch (Exception::Error)

{

info("Error");

}

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Dan Emreus Profile Picture
    1,162 on at

    Hi Maram fraij

    This has most likely to do that your try - catch statement is already inside a transaction and that is not the case when you are running it in a job.

    See this link for expection handling : msdn.microsoft.com/.../aa893385.aspx

    Hope this helps

    /Dan

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 > 🔒一 Microsoft Dynamics AX (Archived)

#1
Priya_K Profile Picture

Priya_K 4

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans