Debugging without a startup project or startup Object in D365

To debug without setting up a startup project and startup object in D365 fotr operations. Follow these steps:

  1. Open your object in visual studio
  2. Place breakpoints
  3. Goto Debug>attach to process and check show processes from all users
  4. Select w3wp.exe and click attach.

DebugWithoutStartupObject

You can execute your process now from the client and execution will be stopped at your breakpoints.

 

Breakpoint symbols not loading AX7/D365

Recently faced a problem where my breakpoints weren’t loading for objects in the AOT that were not in my solution and therefore I could not debug.

Solution: In order to load symbols for objects that have not been included in your solution you have to uncheck the following check box.

Dynamincs365>Options>Dynamics 365>Debugging
Load symbols only for items in the solution

BreakpointsNotLoadingD365

To know more about how to debug in D365 visit: Debug X++

How to Recall/Cancel a workflow through code in AX 2012

To recall a workflow through code you can use the cancelworkflow method in workflow class. It takes the correlationId and a comment as parameters and gets the job done for you. Example

workflow::cancelworkflow(CorrelationId, “Cancelling this workflow”)

Now you are probably thinking How do I find my workflows CorrelationId. You can do that by querying WorkflowTrackingStatusTable sorting it with time and instance number and joining it with SysWorkflowtable against the correlationId field and in the contextId you pass the RecId of your record for example PO RecId.

Fix for Error: Field ‘Company’ and ‘Lot ID’ must be filled in”

When editing a PO line for procurement category you receive Field ‘Company’ and ‘Lot ID’ must be filled in” error. This usually happens when you have brought in the PO line through some form of integration either AIF, excel plugin etc.

This error has also been seen on salesLine and there is a hotfix(KB 2756645) for when it happens on salesline.

Error

Reason:

There is no record in PurchLineForeignTradeCategory table related to PO line added.

 

Solution:

Create a record against the PO line causing this error in the PurchLineFroeignTradeCategory table in your integration and you will see the error disappear.

Difference between Refresh(), Reread(), Research() and ExecuteQuery() in AX 2012

In X++ we have the below methods for fetching data after any changes are made, below is the short description of what they are and when to use each one.

Refresh() refreshes the user view with whats stored in the caches. This does not touch the DB.
Use this after any form change has been made through code.

ReRead() fetches only the current record from database and does not re read the complete datasource.
Use this when you need to update only the current record after modifying any value.

ReSearch() will execute the same query again and fetch the results from the database.
Use this if you need to get the current most data from database.

ExecuteQuery() will run the query again just like research does but it will also take any query changes into account.
Use this is you have modified the query on run-time and need the updated results according to the new query.

Till when do I keep trying?

Everyone has dreams, not all come true but those who chase after their dreams often wonder till when do you chase them? what time should one give up? what if its just not going to happen? First of all know this that every successful person who has achieved his or her dream and made the impossible possible has had these thoughts many times over during their journey and what led them to success was ignoring these thoughts and never giving up.

Never stop trying, you might be this close.

 

The picture above says it all. The dream dies when we want it to die. Worked too hard, take a break but dont quit and get back on it with a fresh mind and will to achieve it this time around. Perfecting something takes time and so does achieving something big or doing something different. Normal is not what you want to be, do you ever refer to a billionaire as normal or the top athlete normal; think for a moment would you ever call Mr. Usain Bolt normal? the answer in your mind is probably no because people like that are extra ordinary! they are not even close to the average Joe. To be successful, to be an achiever and to be ahead of the game; you have to be not normal; you gotta do what others don’t; think what others don’t so you can achieve what others don’t. Now go out there and never quit! Be consistent and show persistence towards your goals so you may one day achieve them.

 

O ye who believe! Persevere in patience and constancy; vie in such perseverance; strengthen each other; and fear Allah.that ye may prosper (Surah Al-Imran, 200)