Skip to main content

Posts

Showing posts with the label AX7

Detailed guide on creating Business Events with Azure Service Bus

I have been working with the new Business Events feature released in FinOps and you should read the docs site first. This blog post focuses primarily on setting up Azure Service Bus endpoint. Setting up the Azure services can be tricky if you are not familiar with Azure Key Vault and application registrations. I have sequenced the post so that you don't have to jump around. There are four key elements to this: Create the app registration Create the service bus Create the key vault secret Configure FinOps Create an App Registration In the Azure Portal, navigate to the Azure Active Directory menu. Click on App registrations (there is the old one and the preview menu - they are the same but the UI is a bit different). I will show the original App registrations way. Create a new Web app/API registration and give it a name. It doesn’t really matter in our case what the sign-on url is. Take note of the Application ID as you will need it later for setting up the...

Approve Workflow via email using template placeholders #Dyn365FO

Dynamics 365 for Finance and Operations has placeholders which can be inserted into the instructions. Normally you would want this to show up in the email that is sent. One of the most useful ones is the URL link to the exact record that you are approving. In the workflow configurations use the placeholder and build up your message. Towards the end it has workflow specific ones. The URL token is %Workflow.Link to web% . For the technical people the token is replaced in this class WorkflowDocumentField. This is what I inserted into my email template. <BODY> subject: %subject% <BR> message: %message% <BR> company: %company% <BR> for: %for% <BR> </BODY> Should look like this. The final result looks like this. If you debug these are the place holders that are put together.

Resolve Budget dimension through X++ [D365FO]

This one is to resolve budget dimensions. Be careful here to use the right class. Budget plan and Budget register use a different contract class. public static void getBudgetLedgerDimension() { //use BudgetPlanningContract for Budget plan //use BudgetAccountContract for Budget register BudgetAccountContract budgetAccountContract = new BudgetAccountContract(); budgetAccountContract.parmValues(new List(Types::Class)); budgetAccountContract.parmAccountStructure('Manufacturing P&L'); DimensionAttributeValueContract attributeValueContract; //Main account attributeValueContract = DimensionAttributeValueContract::construct('MainAccount', '110180'); budgetAccountContract.parmValues().addEnd(attributeValueContract); //Dimension 1 - repeat this for all other dimensions attributeValueContract = DimensionAttributeValueContract::construct('Departmen...

Resolve default dimension through X++ [D365FO]

This one is resolving the Default dimension public static void getDefaultDimension() { DimensionNameValueListContract dimensionNameValueListContract = new DimensionNameValueListContract(); dimensionNameValueListContract.parmValues(new List(Types::Class)); DimensionAttributeValueContract dimensionAttributeValueContract; //Dimension 1 - repeat this for all other dimensions dimensionAttributeValueContract = DimensionAttributeValueContract::construct('Department', '022'); dimensionNameValueListContract.parmValues().addEnd(dimensionAttributeValueContract); //resolve the dimension DimensionNameValueListServiceProvider dimensionNameValueListServiceProvider = DimensionNameValueListServiceProvider::newForDimensionNameValueListContract(dimensionNameValueListContract); DimensionStorageResult dimensionStorageResult = dimensionNameValueListServiceProvider.resolve(); if (dime...

Resolve ledger dimension through X++ [D365FO]

A bit of code to show how to resolve ledger dimensions. There are various codes out there but I thought I would write it in an easy way to understand. It is hard code but I did that for illustration purposes. public static void getLedgerDimension() { DimensionAttribute dimensionAttribute; DimensionAttributeValue dimensionAttributeValue; DimensionSetSegmentName dimensionSet; DimensionStorage dimStorage; LedgerAccountContract ledgerAccountContract = new LedgerAccountContract(); ledgerAccountContract.parmValues(new List(Types::Class)); ledgerAccountContract.parmAccountStructure('Manufacturing B/S'); DimensionAttributeValueContract dimensionAttributeValueContract; //Main account ledgerAccountContract.parmMainAccount('110180'); //Dimension 1 - repeat this for all other dimensions dimensionAttributeValueContract = DimensionAttributeValueContra...

Run a class in background–Asynchronies mode

This is not much of a new thing but a reminder. I feel it should be used more often in D365fFO. In prior versions we showed a progress bar and gave the user a nice feeling that something was processing. In D365fFO we need better a way. If you look at the Data Management, it has a workspace for this. Process runs in async and workspace shows us the status. Code wise, it is pretty simple. Below is an example from standard code. I got it using “Find reference” feature in Visual Studio. Any info or error messages will appear in the message centre. This is great as the user can continue doing their job without waiting. Why am I writing about this? I had a project recently where the a process was taking minutes to run. Based on the amount of data and what it was doing, I found it acceptable that it ran that long. When the user was running it, they perceive it as slow and they are waiting on the screen to refresh. I used runAsync and what do you know – happy customer.

Show deleted items in Source Control Explorer

Common query I have seen a few times. Thought to share a simple tip. There are times when items are deleted or moved to a different model. In that case you may need to see the deleted items to roll it back or see what was deleted. In visual studio, go to the Options and tick the flag to “Show deleted items in the Source Control Explorer”. Alternatively click on this button. Thanks to Joris for pointing it out.

Chain of Command–next() gotcha

UPDATE: 31/10/2017 Microsoft reached out and I have to correct my example code. It seems the compiler does not catch it when it is 2 nested conditions. See below code. Be careful when using Chain of Command not to place the next() call in a condition. Here is an example. Create a class extension for a form. Call the method init() but place it in an “if” condition. Something like this. [ExtensionOf(formStr(PurchReqCreate))] final class PurchReqCreate_EAM_Extension { public void init() { info("Outer - Before next"); if (this.args() && this.args().record() && this.args().record().TableId == -100) //intentionally made it -100 to not execute this code { //doing something here info("Inner - Before next"); if (this.args().record().TableId == -100) { info("Inside second if condition"); } next init(); info("Inne...

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.

Technical dive into the Mobile Platform in Update 10

With the recent Platform update 10 they introduced server side coding and made some enhancements to the mobile platform. This brings a lot of flexibility and capabilities. Below I will focus on just the Expense Management Mobile workspace. For one, the Mobile workspaces are now embedded in the AOT as a resource file. Notice how it says “In metadata”. This indicates that it has loaded from the AOT. I think this is a good move. Its all about ALM. This is also great to keep the server side and client side in sync. The nice thing is that the Expense Mobile solution is in its own model. Makes it easy for us to track and learn from. The main entry is the workspace resource file xml. Notice the guid, this is important for doing some server side coding. Now lets take a look at the workspace class. You will notice the same guid is used for the class attribute. in one of my prior posts, I mentioned that the currency field wasn’t being defaulted when entering a new expense. Now with server side c...

Azure AD Authentication for Windows Applications

In this post I will describe how you can get the login dialog to pop up when you are developing a windows desktop application. Below is an example of the dialog appearing. Below is a sample code how to acquire the token. string authorityUri = "https://login.windows.net/common/oauth2/authorize"; Uri redirectURI = new Uri("https://login.live.com/oauth20_desktop.srf"); AuthenticationContext authenticationContext = new AuthenticationContext(authorityUri); AuthenticationResult authenticationResult = authenticationContext.AcquireTokenAsync( ClientConfig.Default.ActiveDirectoryResource, ClientConfig.Default.ActiveDirectoryClientAppId, redirectURI, new PlatformParameters(PromptBehavior.RefreshSession)).Result; Add the redirect URI for https://login.live.com/oauth20_desktop.srf Reference: https://docs.microsoft.com/en-us/rest/api/datacatalog/authenticate-a-client-app