Skip to main content

Posts

Showing posts with the label Tip

Searching in Event Viewer for #MSDyn365FO

This might seem simple but I thought I would post it anyways. I always tell everyone to check the event viewer if there are unexplained errors or issues with the system. Recently, I was investigating random SOAP messages failing. REST services was working fine. I wasn’t getting any clear errors except that it was forcibly closed. System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. Problem: Where do I look in Event Viewer? In most cases I could guess which folder to look in under Microsoft > Dynamics. Solution: Create a custom view So, I decided to create my own custom view. Tick Critical, Warning and Error. Select the Dynamics logs only. Repeat the error and it should stand out.

Find TableId using table browser #MSDyn365FO

I am usually doing this from the development environment. However, I was debugging a customer environment where I only had access to the front end. I had a table that only gave me the RefTableId. I needed to find out the table that record related to. I used SysTableIdView from table browser. Here is the link. http://usnconeboxax1aos.cloud.onebox.dynamics.com/?cmp=usmf&mi=SysTableBrowser&TableName=SysTableIdView

First look at Azure Functions

Azure Functions allows you to write code that can be triggered by an event or timer. You don’t need a machine to run it on. All the computing runs on the Azure cloud ie sevrverless computing. Below is a quick walk through. Keep in mind Microsoft has great documentation on their site. Just google it. In this post I will put a simple walkthrough. Save you from the information overload. Make sure you are using Visual Studio 2017. Create a project of type “Azure Function” Give it a minute to resolve the NuGet package. You will see a warning icon and watch it disappear by it self. Once its done. Right click and Add item. Select the type of function. The easiest to do is the Http trigger. This will create a class with some sample code. When you run it, it will run a local instance. Navigate to the URL and watch it run. There are many applications in the Dynamics space. Hopefully next time I can cover some Dynamics scenarios.

Table casting in AX 2012 and D365O

D365O is a lot more sensitive about casting or should I say AX2012 was too relaxed about it. This post is to show a specific scenario that works differently in the new version of the product. We had a bit of code that worked fine in AX2012 but stopped working in D365O. After debugging we found that when you cast a table it took the tableId of the cast. Below is an example of AX2012 vs D365O: UPDATE – Thanks for Joris for pointing this out. Same code running in CIL in AX2012. The piece of code in question was running client side. Otherwise, I would have noticed this in AX2012 too.

Dynamics 365 for Operation Web Service calls with POSTMAN

UPDATE: 28 June 2018 - Follow this post for using secret key rather than asking user to log in http://dynamicsnavax.blogspot.com/2018/06/testing-msdyn365fo-odata-with-postman.html In this post I will explain using POSTMAN but it really doesn’t matter what tool you use (SOAPUI is another common tool). The main point I am trying to make is how to put the authentication piece together so you can start messaging to/from the web service. Download POSTMAN from their site https://www.getpostman.com/ In Azure AD register the application. For more info see previous post I wrote http://dynamicsnavax.blogspot.com.au/2016/09/azure-ad-in-new-portal.html For POSTMAN, you need to enter the redirect. POSTMAN would tell you this later when you try to get a token. Redirect URL: https://www.getpostman.com/oauth2/callback Open up POSTMAN and enter your URL you want to send a request to. Click on the bright orange button “Get New Access Token” This dialog will pop up. It will ask f...

AX 7 Working with Version control

This is the landing page for setting up your development environment with version control. https://ax.help.dynamics.com/en/wiki/using-development-tools-in-ax7/ This is relatively easy and setting up a new solution/project works without a problem. In this post,I want to highlight a little gotcha. If you open up a solution and notice the project isn’t bound to version control. i.e. No padlock icon, not able to check out Then it looks like you may have to bind the solution. Open up the solution using source control explorer. You should get this message asking you to bind it. Click on Yes and follow it. Following screen you get. Otherwise, create a new solution that and make sure to tick the “Add to version control” flag in the dialog.

Right click context in AX7

In previous versions we had the ability to override showContextMenu to achieve right click in various controls.. This used have pop the menu and wait for a user response to continue. This concept of waiting for a response doesn’t exist in AX7. So, it has been split into two methods: getContextMenuOptions selectedMenuOption Do a search in the AOT for code examples it’s relatively straightforward.

Referencing a form control [AX7]

I am seeing this a lot more these days because of extensions in AX7. You tend to take the form run in the event and try to get a form control. A lot of developers seem to be hard coding the control name. Not wrong but not the best way to do it. A form control name could change or be deleted. Then you wont catch this until a user runs it. Not so good way: formRun.design().controlName(“MyControlName”) formRun. design().controlName(identifierStr(MyControlName)); The right way: formRun. design().controlName(formControlStr(MyFormName, MyControlName)); This way you get your errors during compile time.

Change password of web config file [AX 7]

It is good practice to change the Administrator password. You might want to be extra secure and also change the other accounts (service accounts). You will notice that the web config file is encrypted when it comes to passwords. You can use the following commands to encrypt/decrypt the file.   To decrypt run this command: C:\AOSService\webroot\bin\Microsoft.Dynamics.AX.Framework.ConfigEncryptor.exe -decrypt C:\AOSService\webroot\web.config To encrypt run this command: C:\AOSService\webroot\bin\Microsoft.Dynamics.AX.Framework.ConfigEncryptor.exe -encrypt C:\AOSService\webroot\web.config   If you make changes you may need to reboot the machine. Restarting IIS didnt work for me when I changed the passwords.

Exchange rate providers using OANDA

This was done for a number of customers but it is good to see it standard in AX7. Friday spotlight goes to … Until next time. I have some exciting blog post ideas but trying to find the time.

Create a new partition [AX 7]

This is a deprecated feature but still works for simple testing. I used it mainly to test importing of configurations in a new clean environment. To create a new partition, you must put the form name at the end of the URL. https://usnconeboxax1aos.cloud.onebox.dynamics.com/?f=partitionadministration Create a new one and save it. To login to the partition, you must do a similar URL parameter by adding the partition name. https://usnconeboxax1aos.cloud.onebox.dynamics.com/?prt=newPartition Note, that the partition have their own data through out. Companies and security must be set up individually. Reference: https://community.dynamics.com/ax/f/33/t/198960

Tax calculation on Net amount - Gotcha

In AX you have various ways of calculating tax . The one that is most confusing is calculating on the Net amount.  I thought I would show a few examples where you can get caught on this. Notice below an example with negative lines. See how the distribution looks wrong but it is right. It distributes the rounded tax amount based on the total of the invoice. Another simpler example where the total of the invoice is zero. There is no tax calculated. There a few things you should consider when choosing this method. Do not add the Tax amount column on the Invoice report. This can make people say it is calculating incorrectly and you having to explain this problem. Standard AX does not have the tax amount column for this reason. If you are integrating with another system, make sure your method of calculating tax is the same. For example, if you are integrating an ecommerce web site with orders. Download the excel file for a working example . Follow the instructions and enter you...

Tip of the day: Set up one environment at a time on LCS

When setting up new environments on LCS, always try to set up one at a time. This is so that you have a bit more control over your environments. Here below I have set up a Developer and a Build VM in one shot. You will notice the controls to start and stop the images are for both VMs.

Hide dimension attribute using XDS [AX 2012]

This was something I had a look at recently. I had to hide certain dimension for specific security roles. I won’t go into the details of why as that is another longer conversation. This can be achieved using XDS (security policy). One thing you have to keep in mind is if a dimension is defaulted it will contain a value. I set up a vendor with a default dimension as per screenshot. On the form it showed the 3 dimensions but in the database it was actually defaulting as above full 5 dimensions. This is because it is defaulting the RecId reference to the dimension value combination.

Multi threading–Adding run time tasks

Last year I posted about multi threaded operation using BOF Also uploaded a sample project you could use to test it out or use as a template. Multithreading with Business Operation Framework [AX 2012] One thing I picked up after testing it in a large scale project which required scheduling it on a non default (blank) batch group. This had a few issues: Originally I was using the  batchHeader.addTask(this.newTaskController(recIdSet)); Below are the two issues of using this method like this. 1. There is a known issue to set the controller execution mode to be Synchronous. Whitepaper: https://www.microsoft.com/en-us/download/details.aspx?id=29215 Screenshot of the known issue. This separates it as its own batch job which disappears after it is finished. This is not the desired result when we are adding tasks at runtime. We want to keep them as tasks under the main batch. 2. Another issue is it will set the batch group as the default batch (blank). In my case the blank bat...

Resolve the ledger dimension in the a different account structure [AX 2012]

Recently I had a look at an error that occurred on a custom journal posting routine. It was somewhat similar the journal allocations by looking at existing transaction to make adjustment. What I didn’t know is the account structure has changed. An error popped up: Account structure X for the combination x-x-x-x-x, is not valid for the ledger X.   When ever using ledger dimensions don’t just stamp the LedgerDimensionRecId. Use this method to resolve the RecId in the current account structure for the current company. toLedgerDimension = DimensionDefaultingService::serviceCreateLedgerDimension(fromLedgerdimension); I had to do a quick unit test to prove this. Below is a job that converts. Code: static void resolveLedgerDimension( Args _args) { //My expected values are //Dimension display value = '1.1.4.2.03--' //Account structure and dimension From RecId - Brazil - 52565566264 //Account structure and dimension Resolved RecId - Brazil SI - 2256553...

Multithreading with Business Operation Framework [AX 2012]

In this post I will discuss the basics of multi threading with business operations framework and I will provide a sample you can work with. Multithreading can give you a huge performance boost if you could spin each process separately. The biggest hurdle with writing a process to work via multi threading can be a little confusing and time consuming to develop. So, what I have done is create a generic xpo project which I have used many times as a starting point. Below is a screenshot of what the net result is of my sample project. The xpo contains the following project. Download xpo The \Classes\Processor\process method is the main entry method. If it is run with out the batch it will execute each record separately. Otherwise, if it is run in batch it will bundle the records based on a default bundle size (I have set it to 10). I then use a list to store the 10 customer recIds. The reason I bundle the records is because when you multithread, you may not want to process each r...

Stop workflow submitter from approving [AX 2012 R3 CU8]

This is a common request in previous versions of AX. Usually you would want to stop the submitter from approving their own workflow. Dynamics AX 2012 CU8 has introduced a new flat on the Workflow parameters. “Disallow approval by submitter”. This is a global setting and not workflow specific. To test this out I created a user group with 2 users. One of them being my account. I created a workflow for journals and used Role based assignment to the APTeam user group.   I was allowed to submit it but I found the workflow history had an error. ie Submitter cannot be the approver. I understand why Microsoft has done it this way but I am not a big fan of it. I don’t like introducing errors in the workflow history. It makes the workflow configuration very difficult. Lets say you had a team of 5 users. Each one was able to submit but not approve their own journals. Then you would have to create a complex workflow configuration to deal with all the combination. I have done similar...

Management reporter - increasing performance

Thanks to a colleague of mine who had gone through this with a large data customer and Microsoft support. When using Management reporter try to separate the SQL instance from the AX database. This is because AX has the best practice of setting the max. degree of parallelisation in SQL server to 1. MR does not deal with this that well, it is recommended to leave it as the default value of 0. Since this setting is at server level. The only solution is to have 2 SQL server instances.

Data import export framework cleanup job explained [AX 2012]

Data import export framework has a clean up job in periodic menu. I hardly see people running it to clean up old staging table data. One thing people are worried about is deleting something that may not have been processed. Below are the conditions for the status.