Microsoft Dynamics AX 2012
Excel Add-in – Questions and Answers (Business Logic)
Purpose: The purpose of this document is to provide answers to frequently asked questions related to Microsoft Dynamics AX 2012 Excel Add-in.
Question: How can I execute additional business logic using Microsoft Dynamics AX 2012 Excel Add-in?
Answer: Microsoft Dynamics AX 2012 Excel Add-in uses AIF Web Services for publishing the data into Microsoft Dynamics AX 2012. In order to automate certain processes or execute additional business logic you can override updateNow method in appropriate AIF Document class and implement necessary business logic in X++. In this document to illustrate main concepts I will use General journal (LedgerGeneralJournalService) and Customer Payment journal (LedgerCustPaymJournalService) Web Services in Microsoft Dynamics AX 2012.
Details
Every AIF Web Service has corresponding Document class in AOT, usually these classes are prefixed with Axd. For example, General journal Web Service Document class is AxdLedgerGeneralJournal class and Customer Payment journal Web Service Document class is AxdCustPaymJournal class. Focusing on Business Logic aspect in this investigation we'll take a closer look at Framework classes implementing create and update operations.
Classes\AxdBaseCreate\Methods\deserializeDocument
Call Stack:
<![if !supportLists]>- <![endif]>Classes\AxdBase\Methods\updateNow
<![if !supportLists]>- <![endif]>Classes\AxdBaseUpdate\Methods\postProcessDocument
<![if !supportLists]>- <![endif]>Classes\AxdBaseUpdate\Methods\deserializeDocument
<![if !supportLists]>- <![endif]>Classes\AxdBaseCreate\Methods\createDocumentList
<![if !supportLists]>- <![endif]>Classes\AxdBase\Methods\createList
<![if !supportLists]>- <![endif]>Classes\AifDocumentService\Methods\createList
Classes\AxdBaseUpdate\Methods\postProcessDocument
Call Stack:
<![if !supportLists]>- <![endif]>Classes\AxdBase\Methods\updateNow
<![if !supportLists]>- <![endif]>Classes\AxdBaseUpdate\Methods\postProcessDocument
<![if !supportLists]>- <![endif]>Classes\AxdBaseUpdate\Methods\deserializeDocument
<![if !supportLists]>- <![endif]>Classes\AxdBaseUpdate\Methods\updateDocumentList
<![if !supportLists]>- <![endif]>Classes\AxdBase\Methods\updateList
<![if !supportLists]>- <![endif]>Classes\AifDocumentService\Methods\updateList
…
updateNow method in Document class will be executed as a last step (post-processing) after AIF message processing which allows you to execute additional business logic
For example, after General journal will be created or updated via General journal Web Service certain fields such as Journal balance, etc will be updated
Classes\AxdLedgerGeneralJournal\Methods\updateNow
For comparison in Rich Client when you post General journal Journal balance update is triggered from Form in "Validate" (and "Post") button clicked method
Forms\LedgerJournalTransDaily\Designs\DesignList\ButtonCheckJournal\Methods\clicked
Another example is Customer Payment journal when after its creation or update in certain scenarios it may be necessary to generate Settlements against Customer invoices
Classes\AxdCustPaymJournal\Methods\updateNow
Typical requirement for automation is when you need to automatically post General journal after its successful creation. Please see below how you can implement this requirement in Microsoft Dynamics AX 2012
LedgerJournalPost::postJournal(LedgerJournalTable, false);
|
Classes\AxdLedgerGeneralJournal\Methods\updateNow
If you face with this requirement I'd also recommend introducing dedicated parameter in UI to control whether it's required or not to automatically post General journal when General journal AIF Web Service is invoked
Once you change necessary Document class please generate CIL because all AIF Web Services related code in Microsoft Dynamics AX 2012 is executed in CIL on the server
Please also note that if you use Tables (Add Tables) in Microsoft Dynamics AX 2012 Excel Add-in the system will use Generic Document Web Service at the back-end
Version: Microsoft Dynamics AX 2012 R2
Tags: Dynamics ERP, Dynamics AX 2012, Excel, Dynamics AX 2012 Excel Add-in, Data Import, Data Conversion, Data Migration, Application Integration Framework, Question, Answer, Business Logic.
Note: This document is intended for information purposes only, presented as it is with no warranties from the author. This document may be updated with more content to better outline the issues and describe the solutions.
Author: Alex Anikiev, PhD, MCP
Really nice post!!! Now a days Microsoft Dynamics AX Implementation is very useful... Thanks for sharing such a great information...
ReplyDeleteThere is a bug in LedgerCustPaymJournalService where payment journals cannot be posted because web service does not set the offset account. So it appears that this service was not fully tested by Microsoft AX development team, but they have posted a hot fix here: http://support.microsoft.com/kb/2580458
ReplyDeleteMau Banyak Bonus?, Yuk Gabung Disini >> judi sabung ayam online
ReplyDelete
ReplyDeleteA great post and blog. Such information will be useful to every beginner and an advanced user.
I just start my adventure with ax dynamics and with the internet of things https://ax-dynamics.com/internet-of- things-iot .
Do you think it's a good connection?
Shipping Company in Riyadh
ReplyDeleteInsect control company in Jizan Water leak detection company in Taif Moving furniture in Taif Important tips when isolating process Ceramic flooring types and wood flooring Examination Company Villas in Riyadh Steam cleaning company in Taif
Financial Restoration Through the help of benjamin lee. Email: 247officedept@gmail.com that's his Email and this is his whatsapp number +1-989-394-3740 . I'mLeonardo Hugo a agronist who was able to revive his dying Livestock Feed Manufacturing through the help of a GodSent lender known as Benjamin Briel Lee the Loan Officer. I want you to know that his Service is the right place for you to resolve all your financial problem because am a living testimony and I can't just keep this to myself when others are looking for a way to be financially lifted. I want you all to contact this God sent lender using the details as stated in other to be a partaker of this great opportunity and also they work with good/reputable bank that wire money transfer without delay into my account.
ReplyDelete