tag:blogger.com,1999:blog-65351604227703597332024-03-15T15:48:49.426+05:00DAXperienceDAXperience has evolved into a more rich technical content blog covering wast & diverse areas of software development and enterprise solutions. Dynamics AX 2012 is the solution for enterprises from Microsoft to integrate all their business needs and desires under ONE more user friendly, user adaptive and closer to the business. DAXperience is not JUST ANOTHER Dynamics AX blog, its there to educate you and me and all of us :)Anonymoushttp://www.blogger.com/profile/10820008079284038516noreply@blogger.comBlogger65125tag:blogger.com,1999:blog-6535160422770359733.post-64566282926644338542016-03-06T15:31:00.000+05:002016-03-06T15:31:07.583+05:00AX 2012 R2: Prevent startup of checklists<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="text-align: left;">
AX 2012 R2: Model upgrade check list does not disappear</h2>
<div>
<br /></div>
<div>
<br /></div>
<h3 style="text-align: left;">
Subject</h3>
<div style="text-align: justify;">
This post discusses a scenario when the ModelStore gets updated after applying KB hot fix. However the checklist keeps coming after it is fully completed and there is no way to make it disappear permanently.</div>
<br />
<br />
<h4 style="text-align: left;">
Audience</h4>
Dynamics AX 2012 (FP, R2 R3) X++ Developers, Technical consultants, Functional consultants, and advanced users.<br />
<br />
<br />
<h3 style="text-align: left;">
Background</h3>
<div style="text-align: justify;">
Hot fix implementations are a regular task for developers and technical personnel alike. After any hot fix, a checklist is presented to the user mainly to recompile the whole application and synchronize. The checklist depends on the type of upgrade and can be of the following type</div>
<div style="text-align: justify;">
<br /></div>
<br />
<br />
<h3 style="text-align: left;">
Problem</h3>
<span style="text-align: justify;">Sometimes however, hot fix implementation fails which can have any reason. In our scenario we faced a similar situation where we had to undo the hot fix. We simply restored the model store database. However the model upgrade checklist would keep coming.</span><br />
<br />
<br />
<h3 style="text-align: left;">
Checklist Framework</h3>
<div>
There is a solution provided by the framework. It is the menu item provided in the Checklist section. The full navigation is: <i><dataareaid>/System administration/Area page/Setup/Checklists/Prevent startup of checklists</dataareaid></i></div>
<div>
<i><br /></i>
<i><br /></i></div>
<h4 style="text-align: left;">
What it does ?</h4>
<div>
<br /></div>
<div>
Points to Action menu item: <b><i>SysCheckList_InitNoUpdate</i></b></div>
<div>
Which then calls the <b><i>SysCheckList</i></b> class with the base enum: <b><i>SysCheckListType</i></b> and <b><i>SetDB</i></b> as selected value. </div>
<div>
The main method for this base enum value provided runs the following</div>
<div>
<pre class="brush: AX" name="code">
case SysCheckListType::SetDB :
SysCheckList::initNoUpdate(true);
return; //mark upgrade and setup as finished
</pre>
</div>
</div>
<div>
<br /></div>
<div>
<br /></div>
<div style="text-align: justify;">
This method fires the SysSetupLog::saveEx() and SysSetupPartitionLog::saveEx() methods which updates the SysSetupLog and SysSetuppartitionLog tables with values representing the completed status for each type of checklist. These methods are called for each checklist type. This is achieved by sending the name of the class specialized for each checklist type to the save methods. Hence for each type, a complete record is maintained in the database. This gives the hint that this table is read at the client startup to evaluate if any checklist remains to be updated. See image below<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj1DSe88SRhoQwD-eO52NBjBerFxJBXgo9Cx4SoWrZJvCc7uLch4huWWgFr-O5e2ByuME3Gz62VbQDGPUiQoJKZwTWF4qS00OKEwIDVpDw_K4HsgSD0IMMA5NbwvHN6YrfKZUbohKw7ehqV/s1600/2016-03-06+%25282%2529.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="180" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj1DSe88SRhoQwD-eO52NBjBerFxJBXgo9Cx4SoWrZJvCc7uLch4huWWgFr-O5e2ByuME3Gz62VbQDGPUiQoJKZwTWF4qS00OKEwIDVpDw_K4HsgSD0IMMA5NbwvHN6YrfKZUbohKw7ehqV/s320/2016-03-06+%25282%2529.png" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">SysCheckList::initNoUpdate() method body</td></tr>
</tbody></table>
<br /></div>
<div>
<br /></div>
<h4 style="text-align: left;">
A failed attempt</h4>
<div>
<br /></div>
<div style="text-align: justify;">
I marked all such records as completed. Nothing happened. Checklist kept coming. There is definitely more to the doings of the mentioned method which I would have missed in my update query.<br />
<br />
The focus of this post is not to understand the SysCheckList class and its internals, neither was it my focus when trying to get rid of the checklist. So... I googled :D<br />
<br />
<br />
<h2>
Solution</h2>
</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: left;">
<blockquote class="tr_bq">
SysCheckList_Update::finalizeMinorUpgrade();</blockquote>
</div>
<br />
<div style="text-align: justify;">
The link shared in the following section provided the solution to this problem. This is why for every such problem, we should try to searching for relevant API provided in the framework.<br />
<br />
This method actually does similar things discussed above along with deleting unwanted records from <b><i>SysSetupLog</i></b> table and updating the <b><i>ReleaseUpdateConfiguration</i></b> table. However, it does it fully and bring results.</div>
<br />
<h3 style="text-align: left;">
Links</h3>
<br />
<ul style="text-align: left;">
<li>http://dynamicsuser.net/forums/p/76421/421256.aspx </li>
</ul>
</div>
Anonymoushttp://www.blogger.com/profile/10820008079284038516noreply@blogger.com1tag:blogger.com,1999:blog-6535160422770359733.post-42651030931741504262016-02-15T12:18:00.000+05:002016-02-15T12:18:39.303+05:00#AX7SERIES: Some basic terminologies and concepts<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="text-align: left;">
Terminologies and Concepts</h2>
<div style="text-align: left;">
In this post, we provide high level definitions for some basic concepts for AX7 Development. Not all of these concepts are new, so it will be a piece of cake for all AX developers.</div>
<div style="text-align: left;">
<span style="font-weight: normal;"><span style="font-size: xx-small;"><br /></span></span>
<span style="font-weight: normal;"><span style="font-size: xx-small;"><br /></span></span></div>
<div style="text-align: left;">
<span style="font-weight: normal;"><span style="font-size: xx-small;">This post will be used as a reference post for the next posts coming in #AX7SERIES</span></span></div>
<h2 style="text-align: left;">
</h2>
<div>
<br /></div>
<div>
<h2 style="text-align: left;">
Elements: </h2>
<div style="text-align: left;">
Any AOT element like form or table (similar to AX2012)</div>
<h2 style="text-align: left;">
</h2>
<div>
<br />
<h2 style="text-align: left;">
Projects: </h2>
<div style="text-align: left;">
Logical grouping of AOT Elements (similar to AX2012)</div>
<div>
<br /></div>
<h2 style="-webkit-text-stroke-width: 0px; color: black; font-family: 'Times New Roman'; font-style: normal; font-variant: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;">
</h2>
</div>
</div>
<h2 style="text-align: left;">
Models: </h2>
<div style="text-align: left;">
Grouping of elements representing distributable software solution. One element can only exist in one model, not the other. Design time concept</div>
<h2 style="text-align: left;">
</h2>
<div>
<br /></div>
<h2 style="text-align: left;">
Packages: </h2>
<div style="text-align: left;">
New concept in AX 7. Deployment unit. Contains one or more models. Can be exported to file which can be deployed on other environments like staging or production</div>
<div>
<br />
<br /></div>
</div>
Anonymoushttp://www.blogger.com/profile/10820008079284038516noreply@blogger.com1tag:blogger.com,1999:blog-6535160422770359733.post-39179490697885662182016-02-10T17:53:00.004+05:002016-02-11T13:58:47.507+05:00#AX7SERIES: Power of Visual Studio<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="text-align: left;">
#AX7SERIES: Power of Visual Studio IDE</h2>
<div>
<br /></div>
<div>
<br /></div>
<h4 style="text-align: justify;">
The #AXSERIES is an attempt to cover all the new things in the development paradigm in AX7 with a difference oriented approach between the ex and new version of the ERP making it easier for the developers to jump in the new environment </h4>
<br />
<br />
<h4 style="text-align: left;">
<span style="font-size: x-small;">
Audience</span></h4>
<span style="font-size: x-small;">AX 7 enthusiasts, Dynamics AX 2012 (FP, R2 R3) X++ Developers, Functional and Technical consultants and advanced users</span><br />
<br />
<br />
<br />
<div style="text-align: justify;">
Ok I somehow managed my time to continue this blog series. I tell you what, I am not very busy actually, but still I dont know where my time goes :D</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Anyways cutting the chatter, lets get straight to the point. This blog post will share some intersting things that were totally IMPOSSIBLE in AX AOT IDE thus titling this "POWER OF Visual Studio IDE"</div>
<div style="text-align: justify;">
<br /></div>
<h3 style="text-align: justify;">
Categorization of AOT Items</h3>
<div style="text-align: justify;">
IDE provides two ways or views to see and access AOT Items<br />
<span style="text-align: left;"><br /></span>
<br />
<h3>
<span style="text-align: left;">Classic view</span></h3>
</div>
Same old way (new color scheme due to whole new IDE though :P) illustrated as follow
<br />
<div style="text-align: center;">
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi6KyrM5H0CZ-JxwrRA_XoxnwLZWUVo4kg6vDdOFKkZ9UtwKhV7uW6CfkLTz3ytfiirysQr59WtBbnUptrLi-deW_lV1NHTwKVTQFgJTyENUjoZU9SZTau9hT4tAcA8l7VU7yOYnaYo3tdI/s1600/00_classicView.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi6KyrM5H0CZ-JxwrRA_XoxnwLZWUVo4kg6vDdOFKkZ9UtwKhV7uW6CfkLTz3ytfiirysQr59WtBbnUptrLi-deW_lV1NHTwKVTQFgJTyENUjoZU9SZTau9hT4tAcA8l7VU7yOYnaYo3tdI/s320/00_classicView.png" width="224" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">AOT - Classic view</td></tr>
</tbody></table>
</div>
<h3>
<br />
Model View</h3>
Provides a list of Models stored as default by the installation along with new models created by devs. <br />
<br />
<div style="text-align: center;">
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjp3f86nIX-CwCroQOtkbCA2jXJWvVSEdaRD2I2rzFh7NyWfek8-wxB87lK4bp6ChiFuz3k13bOOp1DuNdxf0_S5vMY29Tj8MPNY_s2oK2AEIN23FFhbBhOSPPoRusk49g72O7KE5yJyuET/s1600/01_switch+to+Model+view.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="216" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjp3f86nIX-CwCroQOtkbCA2jXJWvVSEdaRD2I2rzFh7NyWfek8-wxB87lK4bp6ChiFuz3k13bOOp1DuNdxf0_S5vMY29Tj8MPNY_s2oK2AEIN23FFhbBhOSPPoRusk49g72O7KE5yJyuET/s320/01_switch+to+Model+view.png" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">New option, 'Model view'</td></tr>
</tbody></table>
</div>
<br />
<div style="text-align: center;">
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhhMXj7bu71i_kfrcvrCUCPtWSZ345LHykRT_S-W4oedCAHytVvESdPxr1HNQS8yR_3-dHvcxkF7XGxGOF3G6XhicznJyfPN6rU_OJXshxyoxN88RvxhaRqOQrrA-wpWY_k3vhvGzhxIeSg/s1600/02_viewAOTItemsByModels.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhhMXj7bu71i_kfrcvrCUCPtWSZ345LHykRT_S-W4oedCAHytVvESdPxr1HNQS8yR_3-dHvcxkF7XGxGOF3G6XhicznJyfPN6rU_OJXshxyoxN88RvxhaRqOQrrA-wpWY_k3vhvGzhxIeSg/s320/02_viewAOTItemsByModels.png" width="274" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">AOT in Model view</td></tr>
</tbody></table>
</div>
<div>
<br /></div>
<h3 style="text-align: left;">
Search AOT Items</h3>
<div>
Second is the searching. Imagine how quick the access would become if you can search in the whole AOT without going to a specific node, what we call in Arabic, "Halwa" #sweat</div>
<div>
<br /></div>
<div>
<div style="text-align: center;">
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzVdTiK9T8M6Bn30tw36xHz5QG67xVVLQXsIkgAHhLv9Yvy8vKxIWPZw8QnKxZnP8bIN2Y6F6YvH5gNUM50jTIksvG1v1oZkvaFdwNTzu0HKFmtf7l1ZHPCEzqlxm1KTtp45ffOHTn7s2L/s1600/04_searchInAOT.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="306" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzVdTiK9T8M6Bn30tw36xHz5QG67xVVLQXsIkgAHhLv9Yvy8vKxIWPZw8QnKxZnP8bIN2Y6F6YvH5gNUM50jTIksvG1v1oZkvaFdwNTzu0HKFmtf7l1ZHPCEzqlxm1KTtp45ffOHTn7s2L/s320/04_searchInAOT.png" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Search in AOT - excellent!</td></tr>
</tbody></table>
</div>
</div>
<br />
<br />
<h3 style="text-align: justify;">
Saving development items on local machine</h3>
<div style="text-align: justify;">
Yes sir, in #AX7, you code gets saved in your local folder. You sync with AOS at later stage perhaps.<br />
<div style="text-align: center;">
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg4rtGJjXQcl1co76ficHc9FagNJumE5c178CNQi2iBwJU5Q43Y2Pm4rBf1A_y-OHZ_V7mFP3yRFPyJp3lIrzzOoHFPOn1f6v8iGSFppHJ7wE3B_hO771zVdCMLcSifeQMNG6I_dBq4Npa1/s1600/05_projects_DevItems_savedonLocalHDD.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="165" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg4rtGJjXQcl1co76ficHc9FagNJumE5c178CNQi2iBwJU5Q43Y2Pm4rBf1A_y-OHZ_V7mFP3yRFPyJp3lIrzzOoHFPOn1f6v8iGSFppHJ7wE3B_hO771zVdCMLcSifeQMNG6I_dBq4Npa1/s320/05_projects_DevItems_savedonLocalHDD.png" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Save projects at local drive</td></tr>
</tbody></table>
</div>
</div>
<div style="text-align: justify;">
<br /></div>
<h3 style="text-align: justify;">
Code windows and tabs: Beautifullll</h3>
<div style="text-align: justify;">
Why I am getting so excited is due to the HUGE PLUS we will get after migrating to the VS IDE. Imagine no more scrolls and clicks in the left method list. All code for one class / table in one code window with multiple code sub tabs openable</div>
<div style="text-align: justify;">
<div style="text-align: center;">
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi62fLFRJTz62Pepeea4RV4_-Xj8kiVenVxnpKLBbS1COoaBegM8apvJv8LV53iDgY5yP5OLpJGDL69KvC9FheQxjhpdq4WjgKHvfNTJiNF_dC2QWCw3JI9jNqqRlij16rjby1h0wHcRgXl/s1600/06_allClassCodeinsameWindow.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="180" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi62fLFRJTz62Pepeea4RV4_-Xj8kiVenVxnpKLBbS1COoaBegM8apvJv8LV53iDgY5yP5OLpJGDL69KvC9FheQxjhpdq4WjgKHvfNTJiNF_dC2QWCw3JI9jNqqRlij16rjby1h0wHcRgXl/s320/06_allClassCodeinsameWindow.png" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">One tab for all code belonging to a class, form or table</td></tr>
</tbody></table>
</div>
</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
Enjoy links section as cool as ever</div>
<h3 style="text-align: left;">
</h3>
<h3 style="text-align: left;">
Links</h3>
<br />
<ul style="text-align: left;">
<li>Link 1</li>
<li>Link 2</li>
<li>Link.... n</li>
</ul>
</div>
Anonymoushttp://www.blogger.com/profile/10820008079284038516noreply@blogger.com0tag:blogger.com,1999:blog-6535160422770359733.post-58165293920281087102016-02-01T14:01:00.002+05:002016-02-01T14:01:12.973+05:00AX 7: #AX7SERIES X++ Devs welcome To Visual Studio<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="text-align: left;">
#AX7SERIES: Welcome To Visual Studio</h2>
<div>
<br /></div>
<div>
<br /></div>
<h3 style="text-align: left;">
Subject</h3>
This post is the first on the series of AX7 which will feature introduction and the underlying changes<br />
<br />
<span style="font-size: xx-small;"><br /></span>
<br />
<h4 style="text-align: left;">
<span style="font-size: xx-small;">
Audience</span></h4>
<span style="font-size: xx-small;">Visual Studio developers, Dynamics AX 2012 (FP, R2 R3) X++ Developers, Technical consultants and advanced users</span><br />
<br />
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<div style="text-align: justify;">
Since you know that AX7 is out for first look and demos, And the good thing for the all time old school devs is, the long awaited VS integration is here. AX 7 development is completly shifted on Visual Studio. Now since all the old school VS Devs (including me of course) are so fond of the VS IDE (which is probably the best IDE there is), think how cool, quick and smart the work would get when its all done in VS. </div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Secondly, we have some new things to learn as the framework has just been upgraded a little bit. Obviously not a very big change compared to the 2009 - 2012 transition, but not a small one either.<br />
<br /></div>
<div style="text-align: justify;">
Take this for example, all new development artifacts would be stored on local dev machine in the form of files. Quite contrasting to AX 2012 isn't it.<br />
<br /></div>
<div style="text-align: justify;">
With VS 2015+ as the version for development, the performance requirements have also plussed. The same is illustrated in the following snapshot taken from one of the official training videos on DLP</div>
<div style="text-align: justify;">
<br /></div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhMHq749YEvYMMgTMtwgGkF8ezeABs7VMFfAnAIkTYcxTzMNvdhljp7kOGMj4mp2mB5lW6V3oZoHjSTOEDv32KrtiiFR1JawYlu0KOqgYENJ_RP_S1ujI8YL2hZW0ZoE8nWDENN-GoWAD4c/s1600/VS_ToolRequirement.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="164" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhMHq749YEvYMMgTMtwgGkF8ezeABs7VMFfAnAIkTYcxTzMNvdhljp7kOGMj4mp2mB5lW6V3oZoHjSTOEDv32KrtiiFR1JawYlu0KOqgYENJ_RP_S1ujI8YL2hZW0ZoE8nWDENN-GoWAD4c/s320/VS_ToolRequirement.png" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">AX7 Development - Visual Studio requirements</td></tr>
</tbody></table>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<br />
To cater all this, we need a deep study of all such changes and the new things introduced. This is why we have started the new AX7 series which will cater all of this to be shared on this blog. So stay tuned #DAX7ers.<br />
<br />
BY THE WAY Enjoy some cool links in the end</div>
</div>
<div style="text-align: justify;">
<br /></div>
<br />
<h3 style="text-align: left;">
Links</h3>
<br />
<ul style="text-align: left;">
<li><a href="https://mbspartner.microsoft.com/AX/LearningPlans" target="_blank">https://mbspartner.microsoft.com/AX/LearningPlans</a> </li>
<li><a href="https://mbspartner.microsoft.com/AX/ExamPreparationGuides/158" target="_blank">Microsoft Dynamics AX Development Introduction MB6-890 Preparation Guide</a> </li>
<li><a href="https://mbspartner.microsoft.com/AX/Videos/829" target="_blank">Introduction to Development and Customization in Microsoft Dynamics ‘AX 7’</a> </li>
</ul>
</div>
Anonymoushttp://www.blogger.com/profile/10820008079284038516noreply@blogger.com0tag:blogger.com,1999:blog-6535160422770359733.post-68813635809061222292016-01-25T17:04:00.003+05:002016-01-25T17:04:46.555+05:00AX 2012 X++: Add N working days to a date<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="text-align: left;">
AX 2012 X++: Add N working days to a date</h2>
<h3 style="text-align: left;">
</h3>
<h3 style="text-align: left;">
This post provides a few tips, specially focusing the working calendar and working days</h3>
<h4 style="text-align: left;">
<span style="font-size: xx-small;"><br /></span></h4>
<h4 style="text-align: left;">
<span style="font-size: xx-small;">
Audience: </span><span style="font-size: xx-small;">Dynamics AX 2012 (FP, R2 R3) X++ Developers, Functional and Technical consultants and advanced users</span></h4>
<div>
<span style="font-size: xx-small;"><br /></span></div>
<div style="text-align: justify;">
Date operations are every day common tasks for any developer working on a business application. Any good programming language, platform or framework would provide well designed library(ies) with sufficient functionality abstracted in various helper classes and methods to achieve the common and extended date operations. After all, what we want to achieve is re-usability and not reinventing the wheel every now and then.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
AX also has alot of such reusable method to save time and keep consistency. A few are listed below;</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<br />
<ul>
<li><span style="font-family: "georgia" , "times new roman" , serif;"><i>DateTimeUtil</i>: A date time manipulation utility class. Some of its methods are referenced below too</span></li>
<li><i style="font-family: Georgia, 'Times New Roman', serif;">DateTimeUtil::getSystemDateTime()</i><span style="font-family: "georgia" , "times new roman" , serif;">: Works like a Now() method</span></li>
<li><span style="font-family: "georgia" , "times new roman" , serif;"><span style="line-height: 26px;"><i>DateTimeUtil::addMonths(): Add n months to the provided date</i></span></span></li>
<li><span style="font-family: "georgia" , "times new roman" , serif;"><i>dayOfMth(date): </i><span style="line-height: 18px;">Calculates the number of the day in the month for the specified date.</span></span></li>
<li><span style="font-family: "georgia" , "times new roman" , serif;"><span style="line-height: 1.167; text-align: left;"><i>mkDate(int month, day, year)</i></span><span style="line-height: 1.167;">- </span><span style="line-height: 18px; text-align: left;">Creates a date based on three integers, which indicate the day, month, and year, respectively.</span></span></li>
<li><span style="font-family: "georgia" , "times new roman" , serif;"><i>prevYr(date)</i> - Retrieves the date in the previous year that corresponds most closely to the specified date. Similar functions include prevMth() and prevQtr()</span></li>
<li><span style="font-family: "georgia" , "times new roman" , serif;"><i>dateMthFwd(date, int qty): Adds the specified number of months to a date.</i></span></li>
</ul>
</div>
<br />
These all methods are so useful and handy while there are much more to mention. See links section for more.<br />
<br />
<div style="text-align: justify;">
We are more interested in the working calendar. I recently got a scenario in which I had to validate the date from calendar. Then I had to decide the ending date (the famous 'To' date). The resulting date must be a valid date on a calendar. So should I write some algo for it. Experience says such a thing should be available in the library / framework somewhere. Yes this is what is to be shared with all.</div>
<br />
<br />
<h3 style="text-align: left;">
WorkCalendarSched.schedDate Method</h3>
<div style="text-align: left;">
<div style="text-align: justify;">
This sweet method in short takes <i>from date</i>, <i>no of days</i> to add, <i>scheduling direction</i>, <i>calendar id</i> to process against and <i>calendar days flag</i> to schedule the resulting date, awesome. Exactly what I was looking for. Hence using this method, we can add N <b>working </b>days (excluding holidays, weekEnds, etc) to any date. The resulting date is guaranteed to be a working date. Just keep your calendar tight and updated</div>
</div>
<br />
Code sample<br />
<br />
<br />
<pre class="brush: AX" name="code">static void job_testSchedDate(Args _args)
{
WorkCalendarSched workCalendarSched;
SchedDate schedDateFrom, resultantTODate;
Days noOfDays;
CalendarId primCalendar, secCalendar;
workCalendarSched = new workCalendarSched();
noOfDays = 30;
primCalendar = "Default"; secCalendar = "Default";
schedDateFrom = str2Date("21.6.2016", 123); // dd.mm.yyyy
info(strfmt("From date: %1",
date2str(schedDateFrom, 123, DateDay::Digits2, DateSeparator::Slash, DateMonth::Short, DateSeparator::Slash, DateYear::Digits4) ));
// sequence (int) 123 means 1=dd 2=mm 3=yyyy
info(strFmt("Adding %1 days [Working days]", noOfDays));
resultantTODate = workCalendarSched.schedDate( SchedDirection::Forward, // Selecting backward will minus the noOfDays
schedDateFrom,
noOfDays, // number of days to add
NoYes::Yes, // Yes mean bring WorkDays (exclude weekEnds and other configured holidays in between)
primCalendar, secCalendar); // which calendar to be used for date calculation and verification
info(strfmt("Resultant TO date: %1",
date2str(resultantTODate, 123, DateDay::Digits2, DateSeparator::Slash, DateMonth::Short, DateSeparator::Slash, DateYear::Digits4) ));
}
</pre>
<br />
<br />
Output is shared as follows<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiNE8oDjrgsizBRCoUi1bzA0mpTMoYe_2JkPJHdYSWf7XCFFaAda9hiO8DKu6rjvPu6vebksAmNh7Gftl5UkmSd_7lReWb2A8z4L-X5H9uVxy1TLxSh2jkWhlDyLgIk1zi1VEvoIyMYoU1D/s1600/2016-01-25.png" imageanchor="1"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiNE8oDjrgsizBRCoUi1bzA0mpTMoYe_2JkPJHdYSWf7XCFFaAda9hiO8DKu6rjvPu6vebksAmNh7Gftl5UkmSd_7lReWb2A8z4L-X5H9uVxy1TLxSh2jkWhlDyLgIk1zi1VEvoIyMYoU1D/s320/2016-01-25.png" width="236" /></a><br />
<h3 style="text-align: left;">
<br /> Links</h3>
<ul style="text-align: left;">
<li><a href="https://msdn.microsoft.com/en-us/library/workcalendarsched.scheddate.aspx" target="_blank">WorkCalendarSched.schedDate Method [AX 2012]</a></li>
<li><a href="https://community.dynamics.com/ax/b/alirazatechblog/archive/2012/09/03/some-useful-date-functions-in-dynamics-ax-x" target="_blank">Some useful date operations</a></li>
<li><a href="https://axchaitu.wordpress.com/2013/07/27/all-date-functions-in-ax-2012/" target="_blank">All date functions in Ax 2012</a></li>
</ul>
</div>
Anonymoushttp://www.blogger.com/profile/10820008079284038516noreply@blogger.com0tag:blogger.com,1999:blog-6535160422770359733.post-8061077313860603052016-01-18T15:09:00.003+05:002016-01-24T14:55:49.574+05:00AX 2012 R3: ProjUnpostedTransView-Field WorkerName is not compatible with field WorkerName<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="text-align: left;">
ProjUnpostedTransView-Field WorkerName is not compatible with field WorkerName</h2>
<h3 style="text-align: left;">
Subject</h3>
<br />
This post provides insight about a synchronize error received during full AOT for AOT view '<i>ProjUnpostedTransView</i>' and its resolution.<br />
<br />
<h3 style="text-align: left;">
Error</h3>
<blockquote class="tr_bq">
<i>ProjUnpostedTransView:</i> Synchronize database<span class="Apple-tab-span" style="white-space: pre;"> </span>There is a field mismatch in the union query. Field WorkerName is not compatible with field WorkerName.</blockquote>
<br />
<h4 style="text-align: left;">
<span style="font-size: x-small;">
Audience: </span><span style="font-size: x-small;">Dynamics AX 2012 (FP, R2 R3) X++ Developers, Functional and Technical consultants and advanced users</span></h4>
<div>
<h3>
</h3>
<h3>
</h3>
<h3>
Background</h3>
</div>
<div>
We have been facing this issue since day one of our installation of AX 2012 R3 (RTM). Build numbers are as follows;</div>
<div>
<br /></div>
<div>
Microsoft Dynamics AX 2012 R3 (RTM)</div>
<div>
Kernel version: 6.3.164.0</div>
<div>
Application version: 6.3.164.0</div>
<div>
<br /></div>
<h3 style="text-align: left;">
Problem</h3>
When synchronizing the full AOT, the following errors come<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgoCUlhk8p-K9E8lMihKWf5A8fOYZNYDTUgTXUj_WDfW4Y8DyJbtYkLA0mZ8OrRAM78n6SSfXt6_FKX23VxNH_EjwpD8jx5bS_8IrwmOQl7AXlczi4-HnISFTQNrGnwqD73FmVsfPP5eGqu/s1600/00_error_2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="264" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgoCUlhk8p-K9E8lMihKWf5A8fOYZNYDTUgTXUj_WDfW4Y8DyJbtYkLA0mZ8OrRAM78n6SSfXt6_FKX23VxNH_EjwpD8jx5bS_8IrwmOQl7AXlczi4-HnISFTQNrGnwqD73FmVsfPP5eGqu/s320/00_error_2.png" width="320" /></a></div>
<br />
<br />
<h3 style="text-align: left;">
</h3>
<h3 style="text-align: left;">
</h3>
<h3 style="text-align: left;">
</h3>
<h3 style="text-align: left;">
</h3>
<h3 style="text-align: left;">
</h3>
<h3 style="text-align: left;">
<br /></h3>
<div>
<span style="font-size: x-small;"><br /></span>
<span style="font-size: x-small;"><br /></span><br />
<div style="text-align: center;">
<span style="font-size: x-small;">followed by...</span></div>
</div>
<h3 style="text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjpYXIb1C0Q8maMBfTc4DNfSA1kWPW82aoKRfgUhl66EmCHtuFyNJRP9Yv7lwMtUEfX2qDgKntP0YF49C-0-UhD2ansWlYTPlqpavv2GIlzt1oqmgrBZ1GLOWCBVGeXWHW4ln9Zztg8oUAv/s1600/00-1_error.png" imageanchor="1"><img border="0" height="286" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjpYXIb1C0Q8maMBfTc4DNfSA1kWPW82aoKRfgUhl66EmCHtuFyNJRP9Yv7lwMtUEfX2qDgKntP0YF49C-0-UhD2ansWlYTPlqpavv2GIlzt1oqmgrBZ1GLOWCBVGeXWHW4ln9Zztg8oUAv/s320/00-1_error.png" width="320" /></a></h3>
<h3 style="text-align: justify;">
</h3>
<h3 style="text-align: justify;">
Solution(s)</h3>
As per mentioned in the synchronize database error (1), all the errors have come in the View, 'ProjUnpostedTransView'. Exploring the same yields the composition of the view on following sub views.<br />
<br />
<br />
<ol style="text-align: left;">
<li>ProjLedgerJournalTransUnpostedView</li>
<li>TrvExpTransDistributionsUnposted</li>
<li>ProjJournalTransFeeUnpostedView</li>
<li>projCustInvoiceLineDistsUnpostedView</li>
<li>ProjJournalTransHourUnpostedView</li>
<li>ProjProdJournalRouteUnpostedView</li>
<li>InventJournalTransUnpostedView</li>
<li>ProjProdJournalBOMUnpostedView</li>
<li>VendInvoiceInfoLineDistributionsUnposted</li>
<li>ProjOnAccTransUnpostedView</li>
<li>ProjIntercompanyUnpostedExpView</li>
<li>TSUnpostedTimesheetLinesAllView</li>
<li>ProjIntercompanyUnpostedTSView</li>
<li>ProjIntercompanyUnpostedVendInvLineView</li>
</ol>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgqs_Xav954T3WT1NH93p8lHlF0Vv7VH_S_LPK3qFBCRO9ZreUmBCask29mLjUny-kOi_jDFy02IYnlI3ViHXI7buYKIdhCuYh70_KYySMR4vxDvYbfnHdnAEJZAezxrEO4kR6T8VmNa9sO/s1600/2016-01-18+%25281%2529.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="181" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgqs_Xav954T3WT1NH93p8lHlF0Vv7VH_S_LPK3qFBCRO9ZreUmBCask29mLjUny-kOi_jDFy02IYnlI3ViHXI7buYKIdhCuYh70_KYySMR4vxDvYbfnHdnAEJZAezxrEO4kR6T8VmNa9sO/s320/2016-01-18+%25281%2529.png" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Data sources (Views) with mismatching EDTs in their field, WorkerName</td></tr>
</tbody></table>
<div style="text-align: center;">
<br /></div>
<br />
<br />
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Each of these views comprise of one or more tables. And each of these views as a data source has the <i>HCMWorker </i>data source with in further relating to <i>DirPartyTable </i>to fetch the worker name. Closely monitoring each of them reveals that the following four data sources were returning null for the worker name. Obviously the logic implemented would have required the field (since a union query) to have a consistent schema returned. Further to returning null, the fields were provided the extended type, "<i>Name</i>" which was different from what is returned from <i>DirPartyTable </i>> <i>Name </i>field which extends "<i>DirPartyName</i>" extended type. </div>
<br />
<h4 style="text-align: left;">
Data sources with inconsistent extended types</h4>
<div>
<ol style="text-align: left;">
<li>projCustInvoiceLineDistsUnpostedView</li>
<li>ProjProdJournalBOMUnpostedView</li>
<li>ProjInventJournalTransUnpostedView</li>
<li>ProjOnAccTransUnpostedView</li>
</ol>
</div>
<br />
Due to this EDT mismatch, the AOT framework was giving errors.<br />
<br />
Providing the correct extended type of <i>DirPartyName </i>to the WorkerName fields for each of these views made the schema fully consistent, hence error removed.<br />
<br />
<blockquote class="tr_bq">
NOTE: These corrections are to be made in each view used as a datsource and in the field section</blockquote>
<br />
I am unable to find if its a R3 RTM original issue or what, cause i have not been able to find any corresponding hotfix. If any of the readers have any idea, kindly share it with me.<br />
<br />
Thanks :)<br />
<ul style="text-align: left;">
</ul>
</div>
Anonymoushttp://www.blogger.com/profile/10820008079284038516noreply@blogger.com2tag:blogger.com,1999:blog-6535160422770359733.post-77316024794909908932016-01-11T10:24:00.000+05:002016-01-11T10:24:42.084+05:00AX 2012: FormRun.createRecord Method with example<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="text-align: justify;">
AX 2012: FormRun.createRecord Method with example</h2>
<div style="text-align: justify;">
<div style="text-align: justify;">
This post provides a tutorial about the FormRun.createRecord Method which is override able at form level for custom implementation</div>
</div>
<div style="text-align: justify;">
<div style="text-align: justify;">
<span style="font-size: x-small;"><br /></span></div>
</div>
<h4 style="text-align: justify;">
<span style="font-size: x-small;">
Audience</span><span style="font-size: x-small; font-weight: normal;">Dynamics AX 2012 (FP, R2 R3) X++ Developers, Functional and Technical consultants and advanced users</span></h4>
<h3 style="text-align: justify;">
Background</h3>
<div style="text-align: justify;">
<div style="text-align: justify;">
Recently I came through a scenario where I had to use a base table (supporting inheritance) as a Form data source. I needed to ensure which child table's instance is being created. Due to not being totally aware of the table inheritance implementation (and sorry for Microsoft documentation, such things are not specified anywhere) I was relying on my intelligent (or semi intelligent perhaps :D ) guesses. </div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Question: Where is the InstanceRelationType field set to identify the record belonging to a child table.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Thanks to <a href="https://www.linkedin.com/in/nasheet" target="_blank">Nasheet Siddiqui</a> | <a href="https://nasheet.files.wordpress.com/" rel="nofollow" target="_blank">blog</a> a close friend of mine, who guided me in the right direction. As per him, such a thing should be decided by the system at record creation method. And that is the FormRun class method: createRecord().</div>
</div>
<div style="text-align: justify;">
<div style="text-align: justify;">
<br /></div>
</div>
<h3 style="text-align: justify;">
Example</h3>
<div>
<div style="text-align: justify;">
One of the example is the PurchAgreement form, where the system decides at runtime if the agreement line is quantity based or volume based (depending on Comitment type field inrespective helper class instance). This is implemented in PurchAgreementr Form's CreateRecord method. </div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<b>createRecord() implementation at PurchAgreement form</b></div>
<div style="text-align: justify;">
</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<div style="text-align: justify;">
There they have used the FormDataSource's method createType to specify exactly which child table is to be instantiated. Evaluating the commitment type member, a map is instantiated with a value pair of data source name and child table id are set. The map is then sent as parameter to </div>
<div style="text-align: justify;">
FormDataSource > createTypes() method which takes a map in params. This method internally decides the fate of the record i.e which child table the record will belong too. Setting the instancerelationtype members are probably internal to this method.</div>
</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
For even better understanding of concepts, I am attaching this valuable excerpt</div>
<div style="text-align: justify;">
</div>
<br />
<h4 style="text-align: justify;">
An excerpt from Inside Dynamics AX 2012</h4>
<div style="text-align: justify;">
</div>
<blockquote class="tr_bq" style="text-align: justify;">
Traditionally, to create a record in X++ code you only had to call the FormDataSource.create method. However, that method does not let you specify the type. To support the polymorphic creation scenario, use the following method: FormRun.createRecord(str _formDataSourceName [, boolean _append = false]) All create actions performed by the kernel are routed through this method. You should use this method as well instead of the create method. The first parameter specifies the name of the form data source in which to create the record, and the second parameter contains the same append value that is passed to the create method. You can override this to put in conditional code that depends on the type being created. The call to the super of the method executes the correct logic depending on the type.</blockquote>
<br />
<h3 style="text-align: justify;">
Links</h3>
</div>
<div>
<ul style="text-align: left;">
<li><a href="https://msdn.microsoft.com/en-us/library/formrun.createrecord.aspx" rel="nofollow" target="_blank">FormRun.createRecord Method [AX 2012]</a> </li>
<li><a href="https://msdn.microsoft.com/en-us/library/formdatasource.createtypes.aspx" rel="nofollow" target="_blank">FormDataSource.createTypes Method [AX 2012]</a> </li>
</ul>
</div>
<ul style="text-align: left;">
</ul>
</div>
Anonymoushttp://www.blogger.com/profile/10820008079284038516noreply@blogger.com0tag:blogger.com,1999:blog-6535160422770359733.post-15860382349110837562016-01-04T16:12:00.000+05:002016-01-04T16:12:02.441+05:00SQL Server 2012: Rename a database with datafiles<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="text-align: left;">
SQL Server 2012: Rename a database with data files (MDF, LDF)</h2>
This post provides the scripts that will rename a database along with its data files.<br />
<br />
<h4 style="text-align: left;">
Audience</h4>
DB Admins, T-SQL developers, Technical Consultants, AX Developers<br />
<br />
<h3 style="text-align: justify;">
Background</h3>
<div style="text-align: justify;">
In so many scenarios, you may need to rename a database. One general scenario in AX implementation would be when maintaining multiple AX environments at one server like Staging, TEST, DEV and Production. This is also very likely in development and RnD scenarios where you keep restoring LIVE instances backups on a central backstage HUB for data availability.</div>
<div style="text-align: justify;">
<br /></div>
<h3 style="text-align: justify;">
Problem</h3>
<div style="text-align: justify;">
For hosting multiple and different AX servers on a single machine for local availability, you need to have multiple AX server databases hosted with different names. But for that, you need to rename the database since each backup may result in the exact same database name. But you face the problem as you already have a database with exactly same name, 'MicrosoftDynamicsAX' attached to your local server. This can cause problems and you may start thinking how to restore both databases with different names cleanly without disturbing the existing database.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<br /></div>
<h3 style="text-align: justify;">
Solution(s)</h3>
<div style="text-align: justify;">
Properly renaming existing database(s) would let you restore any database coming under the name of MicrosoftDynamicsAX. How I have resolved this issue at my local server is, I rename the existing MicrosoftDynamicsAX database (along with data file names, yes, renaming data files :) ) and the restoring the new database under the same MicrosoftDynamicsAX (or whatever) name. To restore more such instances, I can always rename databases as I like. This I achieve using the attached script. It lets me achieve the following in one go</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Script process</div>
<div style="text-align: justify;">
</div>
<ul>
<li>Set desired database to single user mode</li>
<li>Rename database to new provided name</li>
<li>Takes the database (with new name) to offline mode</li>
<li>Suspends further execution for 5 minutes </li>
<ul>
<li>This is done so that the user is expected to rename the files manually at physical file level.</li>
</ul>
<li>Renames the data files logically</li>
<li>Brings the database back to online</li>
<li>Sets the database again to multi user mode.</li>
</ul>
<br />
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
The script is at the moment hard coded since I was not able to provide variables to a few alter database commands due to command's nature. For this reason, the script is not plug and playable as I had to use symbols to specify the replacing database names. when using, carefully replace sample values with yours and test and master execution on test databases :)</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
This mess would be resolved by dynamically generating SQL and providing user provided database names and other variables to SQL. Therefore as improvement, I am writing a small utility that would enable user to select a database, provide its new name and click and all is done automatically. So stay tuned.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Script can be downloaded from the link: <a href="https://onedrive.live.com/redir?resid=4527435D5AF16DF0!23838&authkey=!AIn_fFQPIot3TCk&ithint=file%2csql" rel="nofollow" target="_blank">Database renaming script</a></div>
<br />
<br />
<ul style="text-align: left;">
</ul>
</div>
Anonymoushttp://www.blogger.com/profile/10820008079284038516noreply@blogger.com0tag:blogger.com,1999:blog-6535160422770359733.post-66843718617910871042015-12-14T19:35:00.000+05:002015-12-14T19:35:47.093+05:00AX 2012 R3 SSRS: publishreportcommand network name cannot be found<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="text-align: left;">
AX 2012 R3 SSRS: publishreportcommand network name cannot be found</h2>
<div>
<div style="text-align: justify;">
<br /></div>
</div>
<h3 style="text-align: left;">
SSRS report deployment gives error, "The network name cannot be found."</h3>
<div style="text-align: justify;">
<br /></div>
<h4 style="text-align: left;">
Audience</h4>
<div style="text-align: justify;">
Dynamics AX 2012 (FP, R2 R3) X++ Developers, Functional and Technical consultants and advanced users</div>
<div style="text-align: justify;">
<br /></div>
<h3 style="text-align: left;">
Background</h3>
<div style="text-align: justify;">
When deploying a SSRS report, you may come across the error. This error will occur while deploying report(s) through AOT as well as using PowerShell scripts.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Experience tells us that such issues may occur if service accounts (AOS, BC proxy, Workflow) are wrongly configured. In our scenario, we had to reconfigure and put the newly provided service accounts. As a result, the reporting services crashed. We made sure all the practices related to configuring system service accounts are met. However we kept getting this error. report deployment were attempted both using AOT and PowerShell<br /><b><br />Solution(s)</b></div>
<div style="text-align: justify;">
Thanks to sharing, the coolest caring. we cam to know the following link that clearly mentioned the reason of this issue.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
https://blogs.msdn.microsoft.com/axsupport/2013/03/13/deploying-reports-in-ax2012-you-need-access-to-the-administrative-share-c/ </div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
In the post, the user uses the <i><span style="color: #93c47d;"><b>verbose </b></span></i>modifier in the publish command in PowerShell to get more details. That yields that a network shared location access is attempted by the script. Now the question is, if such access is available or not. As a resolution, providing the C drive (reporting services server) as network shared resource resolved the issue.</div>
<div style="text-align: justify;">
<br /></div>
<h3 style="text-align: left;">
Links</h3>
<ul style="text-align: left;">
<li style="text-align: justify;"><a href="https://blogs.msdn.microsoft.com/axsupport/2013/03/13/deploying-reports-in-ax2012-you-need-access-to-the-administrative-share-c/" target="_blank">Deploying reports in AX2012 – you need access to the administrative share C$</a> </li>
<li style="text-align: justify;"><a href="https://community.dynamics.com/ax/f/33/t/69685" target="_blank">AX 2012 Deploy report error : The network name cannot be found</a></li>
<li style="text-align: justify;"><span style="color: #0000ee;"><u><a href="http://dynamicsuser.net/forums/p/49632/256009.aspx" target="_blank">AX 2012: Report Deployment error "The network name cannot be found."</a></u></span></li>
</ul>
</div>
Anonymoushttp://www.blogger.com/profile/10820008079284038516noreply@blogger.com0tag:blogger.com,1999:blog-6535160422770359733.post-90947822001794647212015-11-30T18:06:00.000+05:002015-11-30T18:06:48.638+05:00AX 2012 Workflow: Function run has been incorrectly called.<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="text-align: left;">
AX 2012 Workflow: Function run has been incorrectly called.</h2>
<h3 style="text-align: left;">
Workflow submit ends in error notification when submitting to workflow from code</h3>
<blockquote class="tr_bq" style="text-align: justify;">
AX 2012 Workflow: Function run has been incorrectly called.</blockquote>
<br />
<h4 style="text-align: left;">
Audience</h4>
<div style="text-align: justify;">
Dynamics AX 2012 (FP, R2 R3) X++ Developers, Functional and Technical consultants and advanced users</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<br /></div>
<h3 style="text-align: left;">
Background</h3>
<div style="text-align: justify;">
At the point of submitting a workflow, the comment dilog box appears. The class, <workflowsubmitdialog> is constructed needing a <workflowversiontable> table buffer. The tupple must contain a row for the active workflow. This is usually passed by the statement</workflowversiontable></workflowsubmitdialog></div>
<blockquote class="tr_bq" style="text-align: justify;">
args.caller().getActiveWorkflowConfiguration()</blockquote>
The following listing provides a detailed context<br />
<blockquote class="tr_bq">
<br /><blockquote class="tr_bq">
workflowSubmitDialog = WorkflowSubmitDialog::construct (args.caller().getActiveWorkflowConfiguration());</blockquote>
<blockquote class="tr_bq">
workflowSubmitDialog.run();</blockquote>
</blockquote>
<div style="text-align: justify;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEivUul73GpBLQsA6tM1HKSV7WSyezUDUwCHDKN8hg9qre65ifyfBpIe2vLzP4feqjnS3Xm86lcyZaNMdytCrdj89cKh-fiZ3LE1U2Zh4kWV-hsYSrM8SXCK8TfYyg50vZvi-eh9QUQ_AWxs/s1600/1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEivUul73GpBLQsA6tM1HKSV7WSyezUDUwCHDKN8hg9qre65ifyfBpIe2vLzP4feqjnS3Xm86lcyZaNMdytCrdj89cKh-fiZ3LE1U2Zh4kWV-hsYSrM8SXCK8TfYyg50vZvi-eh9QUQ_AWxs/s320/1.png" width="294" /></a></div>
<div style="text-align: justify;">
<br /></div>
<h3 style="text-align: left;">
Problem</h3>
<div style="text-align: justify;">
Our working form stopped to resolve a particular configuration for the workflow. This was pretty strange behavior as a lot of records completed different scenarios of the workflow in success. we refreshed AOT items, generated incremental and FULL CIL, restarted the service, cleared the cache, but nothing worked.</div>
<div style="text-align: justify;">
<br /></div>
<h3 style="text-align: left;">
Solution(s)</h3>
<div style="text-align: justify;">
This must be a configuration or framework issue as a working workflow stopped being not able to find a particular version row (which exists in the table). Several investigatory steps were carried as mentioned in the problems section but none resolved the issue.</div>
<div style="text-align: justify;">
<br /></div>
<h4 style="text-align: left;">
Alternatives</h4>
<div style="text-align: justify;">
The solution should be a framework refresh. The only quick alternative for us was to write an alternative i.e fetch the existing version row our self and provide it to the WorkflowSubmitDialog[C] object. We did as follows;</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
</div>
<ul style="text-align: left;">
<li>Write a custom method in [T]WorkFlowVersion that returns the buffer. The following query does the job</li>
</ul>
<div>
<blockquote class="tr_bq">
select firstOnly1 *<br /> from<br />workflowVersionTblBfr<br /> join workflowTblBfr<br /> where<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>workflowVersionTblBfr.WorkflowTable == workflowTblBfr.RecId &&<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>workflowVersionTblBfr.Enabled == NoYes::Yes &&<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>workflowTblBfr.TemplateName == _wfTemplateName <br /> ;</blockquote>
<ul style="text-align: left;"></ul>
return workflowVersionTblBfr;<br /><ul style="text-align: left;">
<li>Call the new method in the submit method of the WorkFlow SubmitManager class once it is verified that the workflow version is not being fetched by the framework<br /><br /><b>Method navigation</b>: Workflow submit manager class > Submit method > add call after workFlowSubmitDialog object is constructed<br /></li>
</ul>
<blockquote class="tr_bq">
// <t4edu><br /> if (!workflowSubmitDialog || !workflowSubmitDialog.parmWorkflowConfiguration() )<br />workflowSubmitDialog = WorkflowSubmitDialog::construct(WorkflowVersionTable::T4ED_GetWFConfig<br />(workFlowTypeStr(T4EDPurchPORecWFType), tableName2id(tableStr(T4EDPOProdRecConfExtWF)), recId<br />));<br />// <t4edu></t4edu></t4edu></blockquote>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Note: Since you are submitting a workflow, you don't need to look for the record specific workflow version. This would be mandatory if we are taking any action on an already submitted record. In such scenario, we will require to search for configurations that exists in WorkflowWorkItem table for specific table and record.</div>
<h3 style="text-align: left;">
<br /></h3>
<ul style="text-align: left;">
</ul>
</div>
</div>
Anonymoushttp://www.blogger.com/profile/10820008079284038516noreply@blogger.com0tag:blogger.com,1999:blog-6535160422770359733.post-45526011214247250652015-11-23T10:32:00.000+05:002015-11-23T10:36:36.807+05:00AX 2012: Invalid application object name error while creating child table fields<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="text-align: left;">
AX 2012: <span style="text-align: left;">Invalid application object name error while creating child table fields</span></h2>
<h3 style="text-align: left;">
Error message: </h3>
<div style="text-align: justify;">
Invalid name. The application object <objectname> already exists. </objectname></div>
<h4 style="text-align: left;">
Audience</h4>
<div style="text-align: justify;">
Dynamics AX 2012 (FP, R2, R3) X++ Developers, Functional and Technical consultants and advanced users</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<br /></div>
<h3 style="text-align: left;">
Background</h3>
<div style="text-align: justify;">
Using inheritance in tables, you may receive the subject mentioned error</div>
<blockquote class="tr_bq">
<div style="text-align: justify;">
"Invalid name. The application object <objectname>already exists."</objectname></div>
</blockquote>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZKNDm0PsPqIGDKquY_3lPDtnFFriohhJGLB4mOOL5MUEW2MMj7tJD2dGIabz9e-48nN-lu2iuntWHdWhJulg-kfZ_tMAq6XxTh51B-_ozWsi046wDPElhQw_vc9RuwamMTbeo73JvScEY/s1600/1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZKNDm0PsPqIGDKquY_3lPDtnFFriohhJGLB4mOOL5MUEW2MMj7tJD2dGIabz9e-48nN-lu2iuntWHdWhJulg-kfZ_tMAq6XxTh51B-_ozWsi046wDPElhQw_vc9RuwamMTbeo73JvScEY/s320/1.png" width="311" /></a></div>
<div style="text-align: justify;">
<br /></div>
<h3 style="text-align: left;">
Problem</h3>
<div style="text-align: justify;">
This error comes due to the fact that two tables inheriting from the same base table cannot have fields with same name. To avoid such error, you need to put distinct name among each table extending the same base table.</div>
<div>
<div style="text-align: justify;">
<br /></div>
</div>
<div>
<h3 style="text-align: left;">
Reason</h3>
<div style="text-align: justify;">
The reason is not any of the object oriented myths :) The simple reason is that, no matter how many levels of abstraction the AOT layer add to schema items like tables, a table among its extending tables exists only once at the database layer (SQL) . This is like that since child tables actually only exists at AOT layer. Physically there is one single base table. The data resides in one table physically which is abstracted at AOT as child tables. <br />
<br />
That means, if you have a base table with 100 child tables, there would be only one physical table for all of them at the database layer. For this reason, you cannot have same name field(s) for different child tables extending same base table.</div>
</div>
<div style="text-align: justify;">
<br /></div>
<h3 style="text-align: left;">
Conclusion</h3>
<div style="text-align: justify;">
Keep each child table's field names distinct among all sibling tables.</div>
<div style="text-align: justify;">
<br /></div>
<ul style="text-align: left;">
</ul>
</div>
Anonymoushttp://www.blogger.com/profile/10820008079284038516noreply@blogger.com2tag:blogger.com,1999:blog-6535160422770359733.post-43034183400604491642015-11-15T16:48:00.004+05:002015-11-15T16:48:55.707+05:00AX 2012: You are not authorized to access table ‘’ (). Contact your system administrator.<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="text-align: left;">
AX 2012: You are not authorized to access table ‘<tablename>’ (<tablename>). Contact your system administrator.</tablename></tablename></h2>
<h4 style="text-align: left;">
Audience</h4>
Dynamics AX 2012 (FP, R2 R3) X++ Developers, Functional and Technical consultants and advanced users<br />
<br />
<br />
<h3 style="text-align: left;">
Background</h3>
You may experience the subject mentioned error while opening a table / view<br />
<h3 style="text-align: left;">
Problem</h3>
I experienced this error while creating a new view. When I accessed it to see if it is working as expected, I received this error.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhkSAX3IrC3d-3Gi3b_thFVr39BRFIm0XUHzdmuOvPwgeAQVsBJ7PZ6zoGJppbMnx6e03kp-hDfT3yo4YaX3eByx7wD8z41s6pMMwK3viHFdQqhjq91IyginxP1qBTcptmOszrtgtRihZaM/s1600/1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhkSAX3IrC3d-3Gi3b_thFVr39BRFIm0XUHzdmuOvPwgeAQVsBJ7PZ6zoGJppbMnx6e03kp-hDfT3yo4YaX3eByx7wD8z41s6pMMwK3viHFdQqhjq91IyginxP1qBTcptmOszrtgtRihZaM/s320/1.png" width="310" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<br />
I carefully examined and found that actually no fields are added into the view.<br /><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiPqkqUEPlOUqsG9zZWtpamhEZsl70uDCrAGEk5cM1euA60S1aJKk5qMeSgkNN1BzIP10o51BXJh9LFWvDMowBe2OIBPjC-6RznirnPE8YkH60vVRpP5OyJ-8madvNvAZq36wkqBmTlyo8Z/s1600/2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="93" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiPqkqUEPlOUqsG9zZWtpamhEZsl70uDCrAGEk5cM1euA60S1aJKk5qMeSgkNN1BzIP10o51BXJh9LFWvDMowBe2OIBPjC-6RznirnPE8YkH60vVRpP5OyJ-8madvNvAZq36wkqBmTlyo8Z/s320/2.png" width="320" /></a></div>
<br />
<h3 style="text-align: left;">
Solution(s)</h3>
At this point of time, every one knows the solution, add some field dude. Adding fields to the view solves the error. However this error is quite distracting as it can take you to an American Wild Goose chase i.e. towards security and authorization implementations. so keep googling before diving straight into the deep AX sea :P<br />
<br />
<br />
<ul style="text-align: left;">
</ul>
</div>
Anonymoushttp://www.blogger.com/profile/10820008079284038516noreply@blogger.com0tag:blogger.com,1999:blog-6535160422770359733.post-64006863316613027902015-11-12T19:17:00.001+05:002015-11-13T02:50:19.202+05:00AX 2012 - Understanding AOT Maps with an example<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="text-align: left;">
Understanding AOT Maps with an example</h2>
<h3 style="text-align: left;">
Subject: AOT Maps</h3>
<h4 style="text-align: left;">
Audience: Dynamics AX Developers</h4>
<h3 style="text-align: left;">
Background</h3>
<div style="text-align: justify;">
Maps are not new concept in software development actually. They are table wrappers to achieve general behavior. However for lame dude(s) like me, these definition <b>words </b>have not been enough.</div>
<div style="text-align: justify;">
<br /></div>
<h3 style="text-align: left;">
Problem</h3>
<div style="text-align: justify;">
The term allotted to Maps, "Map" itself is a bit confusing. But an example can really help understanding. And Maps are used everywhere, but in comparison to tables and classes ( see these building blocks are essential for any kind of most basic development), use of maps are quite <b>rare</b>.</div>
<div style="text-align: justify;">
<br /></div>
<h3 style="text-align: left;">
Example</h3>
<div style="text-align: justify;">
I have been browsing PurchTableHistory table. A method came into my consideration where I see the use of Map. </div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
The method, <i>PurchTableHistory[T]</i> <b>>></b> <i>initFromPurchTable()</i> declares several maps based on localized buffers. Look at the following code</div>
<div style="text-align: justify;">
<br /></div>
<blockquote class="tr_bq" style="text-align: left;">
<div style="text-align: justify;">
// Code example</div>
<span class="Apple-tab-span" style="white-space: pre;"></span><br />
<div style="text-align: justify;">
<span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-tab-span"> </span>PurchTableMap purchTableMap;</span></div>
<span class="Apple-tab-span" style="white-space: pre;">
</span><span class="Apple-tab-span" style="white-space: pre;"><div style="text-align: justify;">
<span class="Apple-tab-span"> </span>purchTableMap.data(_purchTable.data());</div>
</span><span class="Apple-tab-span" style="white-space: pre;"><div style="text-align: justify;">
<span class="Apple-tab-span"> </span>this.data(purchTableMap.data());</div>
</span></blockquote>
<div style="text-align: justify;">
First, the row from PurchTable is copied to the map variable, '<span style="white-space: pre;">purchTableMap</span>', and then, the history buffer gets the same row but form map, and not from the original source, purchTable buffer</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
WHY ? Their must be a genuine need ? Why don't we copy from the original PurchTable buffer ? Becuase we cannot :) becuase of schema change. See if most of the fields are same but not with exact field names, types and filed list count, we cannot copy a row from one table to another using xRecord[C].data() simply because of schema mismatch.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Here is where map can work, since the different name same type and purpose fields are MAPPED in the MAP :). Fields with different names from different tables are mapped to consistent names in map, so that you can use them to map one row ( from one table buffer) to another table.<br />
<br />
Updated: Rephrasing the above in other words, map can be used to manipulate common schema among different (and having entirely different schema ) tables. It is like not knowing a buffer at runtime, expecting from it to be implementing a consistent schema with labelling issu</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
One more thing, when using maps,<br />
field count doesn't matter since the map will only care and execute on the schema defined in the map. It simply would not care for schema defined in the mapped tables, it would only care for the schema defined in the MAP</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Happy MAPPING</div>
<h3 style="text-align: left;">
Links</h3>
<ul style="text-align: left;">
<li style="text-align: justify;"><a href="https://msdn.microsoft.com/en-us/library/ee330226.aspx?f=255&MSPPError=-2147217396">https://msdn.microsoft.com/en-us/library/ee330226.aspx?f=255&MSPPError=-2147217396</a> </li>
<li style="text-align: justify;"><a href="https://msdn.microsoft.com/EN-US/library/aa624363.aspx">https://msdn.microsoft.com/EN-US/library/aa624363.aspx</a> </li>
<li style="text-align: justify;"><a href="https://msdn.microsoft.com/EN-US/library/bb278211.aspx">https://msdn.microsoft.com/EN-US/library/bb278211.aspx</a> </li>
</ul>
</div>
Anonymoushttp://www.blogger.com/profile/10820008079284038516noreply@blogger.com0tag:blogger.com,1999:blog-6535160422770359733.post-28483220637486179272015-11-11T11:27:00.000+05:002015-11-11T11:27:33.648+05:00AX 2012 - Define items of a combo box at design time<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="text-align: left;">
Combo box in AX 2012</h2>
<div>
</div>
<h3 style="text-align: left;">
Background</h3>
There are numerous ways to load values into a combo box in AX forms. The most common is to use base enums. One way is to use sysTableLookup to load master table data. Another way is to load another form at lookup event and interchange values using args. However sometimes its convenient to define custom items at design time. And such a thing is not very obvious in AX IDE. I recently discovered while answering an <a href="https://community.dynamics.com/ax/f/33/t/179483" target="_blank">AX community post</a> that HcmWorkerLookup form has an other way to do the same.<br />
<br />
We all as ASP.Net developers know that we use to define the members of a ComboBox control. There is a similar way to do the same in AX as well. This is useful if your combo box has small no of items in it which are static, unchangeable values and are not suppose to update<br />
<h3 style="text-align: left;">
Problem</h3>
When you have few static options to provide to user and for some reason, you want to show the user control as a combo box, you better define those few options at design time.<br />
<h3 style="text-align: left;">
Solution(s)</h3>
I love AX due to the rapid development engine and reusable frameworks. AX provides the solution to the above problem definition by providing enough properties to define all the members / items under a combo box control. The ComboBoxControl has three properties which will be used.<br />
<h4>
<span style="font-weight: normal;">You will have to focus on 3 properties on the combo box control. </span></h4>
<h4>
<ol style="text-align: left;">
<li><span style="font-weight: normal;">Items </span><span style="font-weight: normal;">- </span><span style="font-weight: normal;">It is the number of items (count) to appear on the combo at run time.</span></li>
<li><span style="font-weight: normal;">Item</span><span style="font-weight: normal;"> - </span><span style="font-weight: normal;">It is the currently selected item at design time, the following property works on the currently selected item</span></li>
<li><span style="font-weight: normal;">Text </span><span style="font-weight: normal;">- It </span><span style="font-weight: normal;">is the name or caption to appear for the currently selected item (number entered in Item property)</span></li>
</ol>
</h4>
<h4>
<span style="font-weight: normal;">So how will you design it ? E.g. you want three items to appear in your combo with values defined at design time and without involving any BaseEnum or table values or EDT relation. For three items, you will set the </span><span style="font-weight: normal;">Items</span><span style="font-weight: normal;"> property of combo to 3. Then, to define the text values for each item, you will have to repeatedly update the </span><span style="font-weight: normal;">Item</span><span style="font-weight: normal;"> property ( current item ) to 1,2, 3 and provide text value for each in the Text property.</span></h4>
<h4>
</h4>
<h4>
<span style="font-weight: normal;">Try it, its not cool may be, but knowing this IS COOL for sure ;)</span></h4>
<h3 style="text-align: left;">
Links</h3>
<ul style="text-align: left;">
<li>https://community.dynamics.com/ax/f/33/t/179483 </li>
</ul>
</div>
Anonymoushttp://www.blogger.com/profile/10820008079284038516noreply@blogger.com0tag:blogger.com,1999:blog-6535160422770359733.post-30998651993928859842015-08-05T23:48:00.000+05:002015-08-05T23:48:28.509+05:00AX 2012 R3 - Customising the Purchasing Policies<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<div style="background-color: #002b36; color-profile: srgb; color: #839496; font-family: ff-din-web-pro-1, ff-din-web-pro-2, sans-serif; font-size: 16px; font: inherit; line-height: 19.2px; margin-bottom: 10px; margin-left: 10px; margin-right: 10px; margin-top: 10px; max-width: 52em; min-width: 32em; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
<h2 style="border-bottom-color: rgb(131, 148, 150); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(131, 148, 150); border-right-color: rgb(131, 148, 150); border-top-color: rgb(131, 148, 150); color-profile: srgb; color: #b58900; font-family: ff-din-web-pro-1, ff-din-web-pro-2, sans-serif; font-size: 24.624px; font-weight: lighter; font: inherit; line-height: 29.5488px; margin-bottom: 20px; margin-left: 0px; margin-right: 0px; margin-top: 20px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none; vertical-align: baseline;">
This document provides a tutorial to customize the purchase order generation policy. Knowledge shared here can be used to gain a hands on idea to customize the PO generation policy as well as to get a similar idea about other policies coming under the umbrella of purchasing policy like requisition purpose rule and replenishment control rule etc.</h2>
<h1 style="border-bottom-color: rgb(131, 148, 150); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(131, 148, 150); border-right-color: rgb(131, 148, 150); border-top-color: rgb(131, 148, 150); color-profile: srgb; color: #b58900; display: inline-block; font-family: ff-din-web-pro-1, ff-din-web-pro-2, sans-serif; font-size: 24.624px; font-weight: bold; font: inherit; line-height: 19.2px; margin-bottom: 20px; margin-left: 0px; margin-right: 0px; margin-top: 20px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none; text-transform: uppercase; vertical-align: baseline;">
ENTRY POINT:</h1>
<div style="color-profile: srgb; color: #839496; font-family: ff-din-web-pro-1, ff-din-web-pro-2, sans-serif; font-size: 16px; font-weight: lighter; font: inherit; line-height: 19.2px; margin-bottom: 20px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
Workflow (PurchReqReview) class, <code style="color-profile: srgb; color: #839496; font-family: monospace; font-size: 16px; line-height: 19.2px;"><purchreqwftypeeventhandler></purchreqwftypeeventhandler></code> completion event.</div>
<h1 style="border-bottom-color: rgb(131, 148, 150); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(131, 148, 150); border-right-color: rgb(131, 148, 150); border-top-color: rgb(131, 148, 150); color-profile: srgb; color: #b58900; display: inline-block; font-family: ff-din-web-pro-1, ff-din-web-pro-2, sans-serif; font-size: 24.624px; font-weight: bold; font: inherit; line-height: 19.2px; margin-bottom: 20px; margin-left: 0px; margin-right: 0px; margin-top: 20px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none; text-transform: uppercase; vertical-align: baseline;">
FLOW:</h1>
<div style="color-profile: srgb; color: #839496; font-family: ff-din-web-pro-1, ff-din-web-pro-2, sans-serif; font-size: 16px; font-weight: lighter; font: inherit; line-height: 19.2px; margin-bottom: 20px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
At each status method, namely started, cancelled and completed, helper class<code style="color-profile: srgb; color: #839496; font-family: monospace; font-size: 16px; line-height: 19.2px;"><purchreqwfstatustransitionhelper></purchreqwfstatustransitionhelper></code> static methods are called.</div>
<h2 style="border-bottom-color: rgb(131, 148, 150); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(131, 148, 150); border-right-color: rgb(131, 148, 150); border-top-color: rgb(131, 148, 150); color-profile: srgb; color: #b58900; font-family: ff-din-web-pro-1, ff-din-web-pro-2, sans-serif; font-size: 24.624px; font-weight: lighter; font: inherit; line-height: 29.5488px; margin-bottom: 20px; margin-left: 0px; margin-right: 0px; margin-top: 20px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none; vertical-align: baseline;">
Class: PurchReqWFStatusTransitionHelper</h2>
<div style="color-profile: srgb; color: #839496; font-family: ff-din-web-pro-1, ff-din-web-pro-2, sans-serif; font-size: 16px; font-weight: lighter; font: inherit; line-height: 19.2px; margin-bottom: 20px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
As the name suggests, the class responsibility is to run seperate and specific logic per PurchReq. There is a method foe each status like In review, Draft, Approved etc.</div>
<div style="color-profile: srgb; color: #839496; font-family: ff-din-web-pro-1, ff-din-web-pro-2, sans-serif; font-size: 16px; font-weight: lighter; font: inherit; line-height: 19.2px; margin-bottom: 20px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
At (C)<code style="color-profile: srgb; color: #839496; font-family: monospace; font-size: 16px; line-height: 19.2px;"><purchreqwftypeeventhandler></purchreqwftypeeventhandler></code>, at method for the status, "completed",<code style="color-profile: srgb; color: #839496; font-family: monospace; font-size: 16px; line-height: 19.2px;"><completed _workfloweventargs="" orkfloweventargs=""></completed></code>, the following line is called</div>
<pre style="background-color: #073642; color-profile: srgb; color: #93a1a1; font-family: monospace; font-size: 16px; line-height: 19.2px; margin-bottom: 20px; padding-bottom: 15px; padding-left: 15px; padding-right: 15px; padding-top: 15px; white-space: pre-wrap; word-wrap: break-word;"><code style="color-profile: srgb; color: #839496; font-family: monospace; font-size: 16px; line-height: 19.2px;">PurchReqWFStatusTransitionHelper::setPurchReqTable2Approved
(_workflowEventArgs.parmWorkflowContext().parmRecId());
</code></pre>
<div style="color-profile: srgb; color: #839496; font-family: ff-din-web-pro-1, ff-din-web-pro-2, sans-serif; font-size: 16px; font-weight: lighter; font: inherit; line-height: 19.2px; margin-bottom: 20px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
This method in its body calls for logic which first update each PurchReqLine flag after considering the configured Purch Req policy. Then it calls code to generate PO for all PurchReqLines of <consumption style="color-profile: srgb; color: #839496; font-family: ff-din-web-pro-1, ff-din-web-pro-2, sans-serif; font-size: 16px; line-height: 19.2px;">purpose. See code below:</consumption></div>
<pre style="background-color: #073642; color-profile: srgb; color: #93a1a1; font-family: monospace; font-size: 16px; line-height: 19.2px; margin-bottom: 20px; padding-bottom: 15px; padding-left: 15px; padding-right: 15px; padding-top: 15px; white-space: pre-wrap; word-wrap: break-word;"><code style="color-profile: srgb; color: #839496; font-family: monospace; font-size: 16px; line-height: 19.2px;">RequisitionReleaseStrategy::updateManaulDocumentGeneration
(_purchReqTableRecId);
purchReqWFStatusTransitionHelper.doVersioning
(_purchReqTableRecId);
if (purchReqTable.RequisitionPurpose == RequisitionPurpose::Consumption)
{
PurchReqPurchaseOrderGenerationInSync::run(purchReqTable);
}
</code></pre>
<h2 style="border-bottom-color: rgb(131, 148, 150); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(131, 148, 150); border-right-color: rgb(131, 148, 150); border-top-color: rgb(131, 148, 150); color-profile: srgb; color: #b58900; font-family: ff-din-web-pro-1, ff-din-web-pro-2, sans-serif; font-size: 24.624px; font-weight: lighter; font: inherit; line-height: 29.5488px; margin-bottom: 20px; margin-left: 0px; margin-right: 0px; margin-top: 20px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none; vertical-align: baseline;">
System Querying PurchReq PO generation policy</h2>
<div style="color-profile: srgb; color: #839496; font-family: ff-din-web-pro-1, ff-din-web-pro-2, sans-serif; font-size: 16px; font-weight: lighter; font: inherit; line-height: 19.2px; margin-bottom: 20px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
As per above, <code style="color-profile: srgb; color: #839496; font-family: monospace; font-size: 16px; line-height: 19.2px;">(C)ReleaseStrategy</code> >> method <code style="color-profile: srgb; color: #839496; font-family: monospace; font-size: 16px; line-height: 19.2px;"><updatemanauldocumentgeneration></updatemanauldocumentgeneration></code> is called. This method updates each line field <code style="color-profile: srgb; color: #839496; font-family: monospace; font-size: 16px; line-height: 19.2px;"><ispurchaseordergenerationmanual></ispurchaseordergenerationmanual></code> based on query policy data read from DB. It is this flag field in each line in the end that ensures if the PO from this line is to be generated manually or automatically</div>
<h1 style="border-bottom-color: rgb(131, 148, 150); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(131, 148, 150); border-right-color: rgb(131, 148, 150); border-top-color: rgb(131, 148, 150); color-profile: srgb; color: #b58900; display: inline-block; font-family: ff-din-web-pro-1, ff-din-web-pro-2, sans-serif; font-size: 24.624px; font-weight: bold; font: inherit; line-height: 19.2px; margin-bottom: 20px; margin-left: 0px; margin-right: 0px; margin-top: 20px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none; text-transform: uppercase; vertical-align: baseline;">
HOW IS POLICY DATA READ FOR EACH PR LINE ?</h1>
<div style="color-profile: srgb; color: #839496; font-family: ff-din-web-pro-1, ff-din-web-pro-2, sans-serif; font-size: 16px; font-weight: lighter; font: inherit; line-height: 19.2px; margin-bottom: 20px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
<code style="color-profile: srgb; color: #839496; font-family: monospace; font-size: 16px; line-height: 19.2px;">RequisitionREleaseStrategy</code> calls the boolean returning method in a conditional check to evaluate at runtime if the purchReqLIne field <code style="color-profile: srgb; color: #839496; font-family: monospace; font-size: 16px; line-height: 19.2px;"><ispurchaseordergenerationmanual></ispurchaseordergenerationmanual></code> be set to true or not. Consider the following line of code:</div>
<pre style="background-color: #073642; color-profile: srgb; color: #93a1a1; font-family: monospace; font-size: 16px; line-height: 19.2px; margin-bottom: 20px; padding-bottom: 15px; padding-left: 15px; padding-right: 15px; padding-top: 15px; white-space: pre-wrap; word-wrap: break-word;"><code style="color-profile: srgb; color: #839496; font-family: monospace; font-size: 16px; line-height: 19.2px;">PurchReqPurchaseOrderGenerationRule::
isManualCreatePurchaseOrderStatic(purchReqLine)
if (!purchReqLine.VendAccount ||
PurchReqPurchaseOrderGenerationRule::
isManualCreatePurchaseOrderStatic(purchReqLine))
{
purchReqLine.IsPurchaseOrderGenerationManual = true;
purchReqLine.update(false);
}
PurchReqPurchaseOrderGenerationRule::
isManualCreatePurchaseOrderStatic()
</code></pre>
<div style="color-profile: srgb; color: #839496; font-family: ff-din-web-pro-1, ff-din-web-pro-2, sans-serif; font-size: 16px; font-weight: lighter; font: inherit; line-height: 19.2px; margin-bottom: 20px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
inits the class object, sets PurchReqLine buffer via parm method, initializes the policy (abstract from us, not in scope of the topic), and calss the instance method <>. See code below</div>
<pre style="background-color: #073642; color-profile: srgb; color: #93a1a1; font-family: monospace; font-size: 16px; line-height: 19.2px; margin-bottom: 20px; padding-bottom: 15px; padding-left: 15px; padding-right: 15px; padding-top: 15px; white-space: pre-wrap; word-wrap: break-word;"><code style="color-profile: srgb; color: #839496; font-family: monospace; font-size: 16px; line-height: 19.2px;">PurchReqPurchaseOrderGenerationRulepurchReqPurchaseOrderGenerationRule;
purchReqPurchaseOrderGenerationRule = PurchReqPurchaseOrderGenerationRule::construct();
purchReqPurchaseOrderGenerationRule.parmPurchReqLine(_purchReqLine);
purchReqPurchaseOrderGenerationRule.initPolicy();
return purchReqPurchaseOrderGenerationRule.
isManualCreatePurchaseOrder();
</code></pre>
<div style="color-profile: srgb; color: #839496; font-family: ff-din-web-pro-1, ff-din-web-pro-2, sans-serif; font-size: 16px; font-weight: lighter; font: inherit; line-height: 19.2px; margin-bottom: 20px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
The method then checks the line against the policy and returns a boolean, true for manual PO creation, false for auto.</div>
<h2 style="border-bottom-color: rgb(131, 148, 150); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(131, 148, 150); border-right-color: rgb(131, 148, 150); border-top-color: rgb(131, 148, 150); color-profile: srgb; color: #b58900; font-family: ff-din-web-pro-1, ff-din-web-pro-2, sans-serif; font-size: 24.624px; font-weight: lighter; font: inherit; line-height: 29.5488px; margin-bottom: 20px; margin-left: 0px; margin-right: 0px; margin-top: 20px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none; vertical-align: baseline;">
Customizing the PO Generation Policy</h2>
<div style="color-profile: srgb; color: #839496; font-family: ff-din-web-pro-1, ff-din-web-pro-2, sans-serif; font-size: 16px; font-weight: lighter; font: inherit; line-height: 19.2px; margin-bottom: 20px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
isManualCreatePurchaseOrder method can be read to get an idea how to customize this policy to add custom fields and conditional checks and extend the logic to evaluate if PO from PR (WorkFlow) should be generated or not.</div>
<div style="color-profile: srgb; color: #839496; font-family: ff-din-web-pro-1, ff-din-web-pro-2, sans-serif; font-size: 16px; font-weight: lighter; font: inherit; line-height: 19.2px; margin-bottom: 20px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
After reading the simple method, we come to the points as follows;</div>
<ul style="color-profile: srgb; color: #839496; font-family: ff-din-web-pro-1, ff-din-web-pro-2, sans-serif; font-size: 16px; font: inherit; line-height: 19.2px; margin-bottom: 20px; margin-left: 2em; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
<li style="color-profile: srgb; color: #839496; font-family: ff-din-web-pro-1, ff-din-web-pro-2, sans-serif; font-size: 16px; font: inherit; line-height: 19.2px; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">The PO generation policy form is binded with table:<code style="color-profile: srgb; color: #839496; font-family: monospace; font-size: 16px; line-height: 19.2px;"><purchreqsourcingholdrule></purchreqsourcingholdrule></code></li>
<li style="color-profile: srgb; color: #839496; font-family: ff-din-web-pro-1, ff-din-web-pro-2, sans-serif; font-size: 16px; font: inherit; line-height: 19.2px; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">The Table has 5 NoYes enum fields which are rendered on the PO generation policy config form as radio hierarchied buttons</li>
<li style="color-profile: srgb; color: #839496; font-family: ff-din-web-pro-1, ff-din-web-pro-2, sans-serif; font-size: 16px; font: inherit; line-height: 19.2px; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">These fields are evaluated in the (C)PurchReqPurchaseOrderGenerationRule. isManualCreatePurchaseOrder() method.</li>
<li style="color-profile: srgb; color: #839496; font-family: ff-din-web-pro-1, ff-din-web-pro-2, sans-serif; font-size: 16px; font: inherit; line-height: 19.2px; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">To add custom evaluation logic, you can add a field, a relation, or an instanceRelation extension to this table write valid evaluation code for the new schema in the aforementioned method.</li>
</ul>
<div style="color-profile: srgb; color: #839496; font-family: ff-din-web-pro-1, ff-din-web-pro-2, sans-serif; font-size: 16px; font-weight: lighter; font: inherit; line-height: 19.2px; margin-bottom: 20px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
HAPPY PR TO PO GENERATION POLICY EXTENSION</div>
</div>
</div>
Anonymoushttp://www.blogger.com/profile/10820008079284038516noreply@blogger.com1tag:blogger.com,1999:blog-6535160422770359733.post-50795297753250543812015-05-03T03:34:00.000+05:002015-05-03T03:34:44.316+05:00Valid length of a form field label<div dir="ltr" style="text-align: left;" trbidi="on">
AX sometimes surprise you. Such surprise often make you chase a wild goes all day to reveal it was just a dead rat :@<br />
<br />
This just happened with me but all to reveal something I don;t think would be available on internet<br />
<br />
Try these:<br />
<br />
<ol style="text-align: left;">
<li>Find or create a label with 250+ length. </li>
<li>Assign this label to a form field (not static field or any such control)</li>
<li>Open that form</li>
<li>Your client just crashed</li>
</ol>
<div>
Why am I telling this to you at all is the fact that my client wanted me to put huge texts against form fields. Weird, but sometimes we face requirements about which client donot accept any consultancy or education, and we just HAVE to implement it.</div>
<div>
<br /></div>
<div>
Now can you imagine how wild those 400+ length labels made me work and search and find the clue why my client is crashing. I went through everything including full compile, sync, cache cleanup, .auc files, label file regeneration. I had to take every step due to the reason that evenvwr log was not much of a help in my scenario. I am attaching the log for your reference here;</div>
<div>
<br /></div>
<br />
<blockquote class="tr_bq">
Application: Ax32.exe</blockquote>
<br />
<blockquote class="tr_bq">
<blockquote class="tr_bq">
Framework Version: v4.0.30319</blockquote>
<blockquote class="tr_bq">
Description: The process was terminated due to an unhandled exception.</blockquote>
<blockquote class="tr_bq">
Exception Info: System.AccessViolationException</blockquote>
<blockquote class="tr_bq">
Stack:</blockquote>
<blockquote class="tr_bq">
at Microsoft.Dynamics.Kernel.Client.ActionPaneInterop.ClickEventHelper.Clicked(System.Object, System.EventArgs)</blockquote>
<blockquote class="tr_bq">
at Microsoft.Dynamics.Framework.UI.WinForms.Controls.ActionItem.OnButtonClick()</blockquote>
<blockquote class="tr_bq">
at Microsoft.Dynamics.Framework.UI.WinForms.Controls.ActionButton.OnMouseUp(System.Windows.Forms.MouseEventArgs)</blockquote>
<blockquote class="tr_bq">
at System.Windows.Forms.Control.WmMouseUp(System.Windows.Forms.Message ByRef, System.Windows.Forms.MouseButtons, Int32)</blockquote>
<blockquote class="tr_bq">
at System.Windows.Forms.Control.WndProc(System.Windows.Forms.Message ByRef)</blockquote>
<blockquote class="tr_bq">
at System.Windows.Forms.Control+ControlNativeWindow.OnMessage(System.Windows.Forms.Message ByRef)</blockquote>
<blockquote class="tr_bq">
at System.Windows.Forms.Control+ControlNativeWindow.WndProc(System.Windows.Forms.Message ByRef)</blockquote>
<blockquote class="tr_bq">
at System.Windows.Forms.NativeWindow.Callback(IntPtr, Int32, IntPtr, IntPtr)</blockquote>
<blockquote class="tr_bq">
at <module>._wWinMainCRTStartup()</module></blockquote>
<div>
<br /></div>
</blockquote>
<br />
<b>Conclusion</b><br />
Length for a field label (non static text control) is 250</div>
Anonymoushttp://www.blogger.com/profile/10820008079284038516noreply@blogger.com2tag:blogger.com,1999:blog-6535160422770359733.post-51268407754746114152015-01-07T01:07:00.001+05:002015-01-07T01:07:06.389+05:00DAX 2012: OLE DB or ODBC error: Login failed for user 'Domain\UserName$'.; 28000<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="text-align: justify;">
Just resolved a basic error with my functional team mate Qamar Zaman Khan. We both were online, Qamar for reproducing the error. Basically our cube processing was failing with the error, </div>
<div style="text-align: justify;">
<br /></div>
<blockquote class="tr_bq" style="text-align: justify;">
OLE DB or ODBC error: Login failed for user 'Domain\UserName$'.; 28000</blockquote>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
I checked the cube and it had the wrong impersonation settings. I googled and found the issue hence echoing the same to all :D</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
http://stackoverflow.com/questions/18702987/olede-error-login-failed-for-user-domain-computername-28000 </div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
In my case, the sql server analysis service login account was set local account which I think is not a good practice. And as default, the impersonation account is set to service account. Due to this, the impersonation was not working since local account (rendered as Domain\<pcname>) did not had the required accounts on sql as a login. I provided a sql domain account and the error dissappeared :D. Snapshots for your reference</pcname></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEipc0UIpqGHkqU8LrFw9utwECAceqItbqznV1WnICDR1OPiFcW7Dw51MXBIvFhVO1xyFfE3GqU36rkHB7ZE5hd9PSrXn9HsZdpT12ES1_yiA4l0VO4CIFiVu0VV4KJ-sM18rG4AST7MQ84B/s1600/03_impersonation.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEipc0UIpqGHkqU8LrFw9utwECAceqItbqznV1WnICDR1OPiFcW7Dw51MXBIvFhVO1xyFfE3GqU36rkHB7ZE5hd9PSrXn9HsZdpT12ES1_yiA4l0VO4CIFiVu0VV4KJ-sM18rG4AST7MQ84B/s1600/03_impersonation.png" height="180" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEifkVcxbD8siaQ5pBX8QcmTpwf3lBQ3us6vHGhNLs5AzR8NP_SJ8xfcPpkJ9lsmHsPhjhnwkrVB9GtROoD8yc2eF3OJvQQH4DP6osOYeWIRGVkqk4V0jrn-7iy7ILmWYI0MvnvXwgju2NX6/s1600/04_Impersonation+details.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEifkVcxbD8siaQ5pBX8QcmTpwf3lBQ3us6vHGhNLs5AzR8NP_SJ8xfcPpkJ9lsmHsPhjhnwkrVB9GtROoD8yc2eF3OJvQQH4DP6osOYeWIRGVkqk4V0jrn-7iy7ILmWYI0MvnvXwgju2NX6/s1600/04_Impersonation+details.png" height="282" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEibwKJb4riKcHrCHriXgJaCIOndfFLq8vJtu2BquH4mOKwIYUqzH8R-5Wkzux1c_-0c9ahruffeoLY-DZnIuscGnTnHjRF9brHxzTkaHX9dZILKUgnTFE31vvE2laKvBhTbUSP0tZw5l8TE/s1600/05_Impersonation3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEibwKJb4riKcHrCHriXgJaCIOndfFLq8vJtu2BquH4mOKwIYUqzH8R-5Wkzux1c_-0c9ahruffeoLY-DZnIuscGnTnHjRF9brHxzTkaHX9dZILKUgnTFE31vvE2laKvBhTbUSP0tZw5l8TE/s1600/05_Impersonation3.png" height="307" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhMidI0wD485hYuOw-kpoCQkyjKHHvYTuldRBendG_LbGfR_K66BDX4F_7yHpXkwpLyV9L7DWko7Ij6VjkBTrNJZa6eghQnLSbzVicMgXy-Vs9Ctor-7k_BbYLs8y-wvq7OaK1CTSXUCxvc/s1600/01_5_ASCBI.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em; text-align: left;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhMidI0wD485hYuOw-kpoCQkyjKHHvYTuldRBendG_LbGfR_K66BDX4F_7yHpXkwpLyV9L7DWko7Ij6VjkBTrNJZa6eghQnLSbzVicMgXy-Vs9Ctor-7k_BbYLs8y-wvq7OaK1CTSXUCxvc/s1600/01_5_ASCBI.png" height="286" width="320" /></a></div>
<br /></div>
Anonymoushttp://www.blogger.com/profile/10820008079284038516noreply@blogger.com0tag:blogger.com,1999:blog-6535160422770359733.post-11778176060544899972014-12-05T15:05:00.002+05:002014-12-05T15:05:12.916+05:00Enterprise Portal Development Videos<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="text-align: justify;">
I have just started EP development - and I never knew it was all the same - just that proxies adds minor of complexity</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
And guess what - all my web dev xp is gonna get polished back</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
EP comes with some very powerful and ready to use web parts. This post is however a 'LINKS' and not 'TUTORIAL' post, the latter will come by next year since every1 is going for holidays. </div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
So without any delay, here they are, all videos, enjoy:</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
</div>
<ul>
<li><b>How do I videos - Enterprise Portal Development Series: </b><br />http://msdn.microsoft.com/en-us/dynamics/ax/cc507280.aspx<br /></li>
<li><b>Videos at CustomerSource</b></li>
<ul>
<li></li>
<li>Creating simple Enterprise Portal Lookups using EDT, DataSetField and custom lookups using DataSet or User Controls in Microsoft Dynamics AX 2012: http://mediadl.microsoft.com/mediadl/www/d/dynamics/customersource/CCAX2012HT0030_Enterprise%20Portal%20Lookup.wmv</li>
<li></li>
<li>Understanding record context when interacting with data in the Enterprise Portal for Microsoft Dynamics AX 2012: http://mediadl.microsoft.com/mediadl/www/d/dynamics/customersource/CCAX2012HT0029_Enterprise%20Portal%20Record%20Context.wmv</li>
<li>List page development in the Microsoft Dynamics AX 2012 Enterprise Portal: http://mediadl.microsoft.com/mediadl/www/d/dynamics/customersource/CCAX2012HT0031_Enterprise%20Portal%20List%20Page%20Development.wmv</li>
<li>Detail page development in the Microsoft Dynamics AX 2012 Enterprise Portal: http://mediadl.microsoft.com/mediadl/www/d/dynamics/customersource/AX2012CoreConceptsVideo_CCAX2012HT0032_EPDetailsPagesDev.wmv</li>
<li>Developing detail page interactions with Microsoft Dynamics AX 2012 Enterprise Portal, Part1: http://mediadl.microsoft.com/mediadl/www/d/dynamics/customersource/nCCAX2012DI0015_1_Enterprise%20Portal%20Details%20Page%20Interaction%20Patterns%20-%20Part%201.wmv</li>
<li>Developing detail page interactions with Microsoft Dynamics AX 2012 Enterprise Portal, Part2: http://mediadl.microsoft.com/mediadl/www/d/dynamics/customersource/CCAX2012DI0015_2_Enterprise%20Portal%20Details%20Page%20Interaction%20Patterns%20-%20Part%202.wmv</li>
<li>Debugging customizations and new development with the Enterprise Portal for Microsoft Dynamics AX 2012: http://mediadl.microsoft.com/mediadl/www/d/dynamics/customersource/CCAX2012HT0028_Enterprise%20Portal%20Debugging.wmv</li>
</ul>
</ul>
<br />
<br />
<br /></div>
Anonymoushttp://www.blogger.com/profile/10820008079284038516noreply@blogger.com0tag:blogger.com,1999:blog-6535160422770359733.post-46319036420271170182014-11-12T16:44:00.000+05:002014-11-12T16:44:11.498+05:00X++ - Cancelling the event / method in its Pre event handler<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
<div>
<div style="text-align: justify;">
Eventing enables to extend applications as well to decouple the components and underlying implementations. It is a great way to write new logic without worrying a change in the underlying components.</div>
</div>
<div>
<div style="text-align: justify;">
<br /></div>
</div>
<div>
<div style="text-align: justify;">
<h2>
Automatic Event Handlers</h2>
</div>
</div>
<div>
<div style="text-align: justify;">
X++ provides custom delegates as well as Automatic event handlers</div>
</div>
<div>
<ul style="text-align: left;">
<li style="text-align: justify;">Pre - Occurs before</li>
<li style="text-align: justify;">Post - Occurs after</li>
</ul>
</div>
<div>
<div style="text-align: justify;">
<h2>
Pre Event Handler</h2>
</div>
</div>
<div style="text-align: justify;">
One of the responsibilities / usage of the Pre event handler is to validate if all conditions are correct for the commencement of the main method. Or to populate / fill any other component(s) which is required in the main method.</div>
<div>
<div style="text-align: justify;">
<br /></div>
</div>
<div>
<div style="text-align: justify;">
<h2>
Cancel Event</h2>
</div>
</div>
<div>
<div style="text-align: justify;">
This became a pain for me last night. I was trying to do something that we does in DotNet windows application :D </div>
</div>
<div>
<pre style="font-family: Consolas, Courier, monospace !important; font-size: 13px; line-height: 17.5499992370605px; overflow: auto; padding: 5px; word-wrap: normal;"></pre>
<pre style="font-family: Consolas, Courier, monospace !important; font-size: 13px; line-height: 17.5499992370605px; overflow: auto; padding: 5px; word-wrap: normal;">e.Cancel = <span style="color: blue;">true</span>;</pre>
</div>
<div>
<div style="text-align: justify;">
<br /></div>
</div>
<div>
<div style="text-align: justify;">
Where is that ? Answer is, perhaps no where :P (educate me if I am wrong please)</div>
</div>
<div>
<div style="text-align: justify;">
<br /></div>
</div>
<div>
<div style="text-align: justify;">
But there are alternates to it. Thanks to my ex colleague and friend <a href="http://about.me/msheikh" target="_blank">Asim Saeed</a>'s <a href="https://amazingax.wordpress.com/2013/01/20/microsoft-dynamics-ax-2012simple-use-of-eventing-frameworkpart-2use-of-automatic-events/" target="_blank">blog post</a>: Yes it is quite a natural alternate, simply throw an exception.</div>
</div>
<div>
<div style="text-align: justify;">
<br /></div>
</div>
<div>
<div style="text-align: justify;">
<h2>
Problem</h2>
</div>
</div>
<div>
<div style="text-align: justify;">
But that will end the whole program execution, unless caught in any catch and taken care there. What I mean is, consider a complex logic that spans multiple classes or methods. What if one of the optional method's <b>Pre</b> event handler simply throw's exception whereas the process should have continued. In such case, that particular event should be cancelled rather than the whole program flow. I want to have granular control here, only cancel the specfic event producer method, not the whole process </div>
</div>
<div>
<div style="text-align: justify;">
<br /></div>
</div>
<div>
<div style="text-align: justify;">
One way to do this is to have a flag parameter in the event producer method's parameters, set it to false in the <b>Pre </b>event handler on particular condition (i.e. if things are not found good to continue this event). Then at the start of event producer method, simply return out if the status flag is found to be false.</div>
</div>
<div>
<div style="text-align: justify;">
<br /></div>
</div>
<div>
<div style="text-align: justify;">
To demonstrate the same, we have 2 classes,<br />
<br />
<ul>
<li>CMaqkProducer_Event</li>
<ul>
<li>With a method and its event handler subscription</li>
</ul>
<li>CMaqkConsumer_Event</li>
<ul>
<li>With event handlers registered to handle event subscription defined on the producer</li>
</ul>
</ul>
<br />
The code for the producer class is provided for our reference;<br />
<b><br /></b>
<b>Producer class: </b><span style="text-align: left;"><b>Maq_EventProducer</b></span></div>
</div>
<div>
<div style="text-align: justify;">
<br /></div>
</div>
<div>
<div style="text-align: justify;">
<br /></div>
</div>
<div>
<div style="text-align: justify;">
<br /></div>
</div>
<div>
<div style="text-align: justify;">
<br /></div>
</div>
</div>
<pre class="brush: AX" name="code">class Maq_EventProducer
{
#PC
//Macros for Product Configuration, carries #true and #false for sting to bool conversions
}
/// <summary>
/// This method is producing a Pre event handler
/// </summary>
/// <param name="_str" />
/// A sample parameter passed to the method for
///
/// <param name="_status" />
/// Status parameter passed from XppPrePostArgs class containing the result from Pre event Handler
///
/// <remarks>
/// We will return in the begining of this method if the results form Pre event Handler are not ok
/// </remarks>
public void method1(str _str, str _status = "")
{
if (_status == #false)
return;
// continue; ;)
info("Maq_EventProducer.method1() called");
}
/// <summary>
/// Another method besides method1()
/// </summary>
/// <remarks>
/// This method exists and is called to demonstrate continuation of program flow besides event cancellation
/// </remarks>
public void method2()
{
info("second method, Maq_EventProducer.method2() called");
}
</pre>
<div>
<br />
Notice the line 'return;' at the begining of method1() after evaluating the _status defaulted value (string) value with #true. Using this theme, we cancel the whole event from progress.<br />
<br />
<b>Consumer Class: Maq_EventConsumer</b><br />
<br />
<br /></div>
<pre class="brush: AX" name="code">class Maq_EventConsumer
{
#PC
//Macros for Product Configuration
Maq_EventProducer objProducer; //Reference to producer
}
/// <summary>
/// parm method to access producer
/// </summary>
/// <param name="_objProducer" />
/// the reference variable to the event producer class object
///
/// <returns>
///
/// </returns>
/// <remarks>
///
/// </remarks>
public Maq_EventProducer parmObjProducer(Maq_EventProducer _objProducer = objProducer)
{
objProducer = _objProducer;
return objProducer;
}
/// <summary>
/// The static main method
/// </summary>
/// <param name="args" />
/// arguments passed
///
/// <remarks>
///
/// </remarks>
public static void main(Args args)
{
Maq_EventConsumer objConsumer = new Maq_EventConsumer();
Maq_EventProducer objProducer = new Maq_EventProducer();
objConsumer.parmObjProducer(objProducer);
objConsumer.run();
}
/// <summary>
/// the default logic processing method of consumer class
/// </summary>
/// <remarks>
///
/// </remarks>
public void run()
{
info("Consumer class run() method called");
this.parmObjProducer().method1("Maqk");
this.parmObjProducer().method2();
}
/// <summary>
/// The pre Event Handler
/// </summary>
/// <param name="_args" />
/// payload
///
/// <remarks>
///
/// </remarks>
public static void preClass1_Method1(XppPrePostArgs _args)
{
info(strFmt("pre event handler called"));
// Cancelling the event by setting the function's parameter, "_status" = 0
_args.setArg("_status",#false);
// other code logic body may go here
// other code logic body may go here
// Checking if some logic has asked to cancel the event
if (_args.getArg("_status") == #false)
warning("Class1 method1() event cancelled due to condition");
// Later in the event producer method body, we will check the value and would work accordingly if found 0
}
</pre>
<div style="text-align: justify;">
<h2>
Result</h2>
<br />
Calling the consumer class's run() method calls both the methods of producer class. The snapshot below shows the program flow result.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiXPl7SjH4rAVEx6WcdmXkbFY6MzjDZH2CNdmm-do_QdLI_JVs1Mtere8WiC3SgQp6KZejtF3BXelpk_W5T6O88VrPiaUvyjGXcZdrkrsctQaCEp4FbyPM2-9QtJXK5h4R0NfWGf3X7OBHj/s1600/02.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiXPl7SjH4rAVEx6WcdmXkbFY6MzjDZH2CNdmm-do_QdLI_JVs1Mtere8WiC3SgQp6KZejtF3BXelpk_W5T6O88VrPiaUvyjGXcZdrkrsctQaCEp4FbyPM2-9QtJXK5h4R0NfWGf3X7OBHj/s320/02.png" width="285" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Results - Program flow continues only canceling the event</td></tr>
</tbody></table>
<br />
The Pre Event Handler cancels the main event, but the program flow continues. Had we thrown error / warning in the Pre event handler, producer's method2() would not have been called. But now using the event payload (XppPrePostArgs) and having a default value parameter theme, we can only cancel the event we want to and not the whole program flow.</div>
<div style="text-align: justify;">
<br />
<h2>
Links</h2>
<ul>
<li><a href="https://community.dynamics.com/ax/b/brandongeorge/archive/2011/06/29/microsoft-dynamics-ax-2012-eventing-a-look-with-x.aspx" target="_blank">Microsoft Dynamics AX 2012 Eventing - a look with X++</a></li>
<li><a href="http://daxmusings.codecrib.com/2011/07/ax-2012-models-events-part2-events.html" target="_blank">AX 2012 Models & Events Part2: Events</a></li>
<li><a href="http://www.abubakershekhani.com/blogs/technology/microsoft-dynamics-ax-eventing-framework-coded-and-automatic-events" target="_blank">Microsoft Dynamics AX Eventing Framework – Coded and Automatic Events</a></li>
</ul>
</div>
</div>
Anonymoushttp://www.blogger.com/profile/10820008079284038516noreply@blogger.com0tag:blogger.com,1999:blog-6535160422770359733.post-74202262171837107952014-10-17T01:08:00.000+05:002014-10-17T01:08:51.998+05:00SysOperation - How contract class is associated with Controller class ?<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
I recently started to study SysOperation framework. It is the new way to perform the interactive batchable code execution. Compared to RunBaseBatch which had 12 overloads, it has quite few, mainly<br />
<br />
<ul style="text-align: left;">
<li>new (where we specify which class's method to execute actually)</li>
<li>main (where we call the base class's startOperation() method)</li>
<li>\</li>
</ul>
<div>
Apart from these two, another method is a key method, the method mapped in the new() body which is called by the framework on the startOperation() framework method</div>
<ul style="text-align: left;">
<li>customMethod (the method we map in the new() body, this method do not need to reside here, it can be any class;s method, sometimes its the controller method, better practice is to create a service class and place this method there)</li>
</ul>
<div>
The microsoft provided guide might be good for robots and androids, but I am a human and I raise question. There was no where mentioned how a controller class comes to know which contract class is ITS CONTRACT CLASS ?</div>
<div>
<br /></div>
<div>
There was no clue. Only wild or intellegent guesses. One guess was, does it go by the name ? Not possible, simply not a practice at all to follow. Then What ? I read the code hard ? How many places have we provided the reference of a data contract ??? </div>
<div>
<br /></div>
<div>
Yes I got it, instantly I realized this cab only be the contract class parameter passed as argument in the method which was mapped to be called by the framework method, 'startOperation()'. And this is all done in the controller class's new() method body. For proof of concept, I performed a rawwxample at my local machine.</div>
<div>
<br /></div>
<div>
I created a simple controller and 2 ccontract classes one having 1 more argument than the other. The code for all the three classes are provided for our reference;</div>
<div>
<br /></div>
<div>
<br /></div>
</div>
Controller Class
<br />
<pre class="brush: AX" name="code">class MaqkControllerClass extends SysOperationServiceController
{
}
void new()
{
super();
this.parmClassName(classStr(MaqkControllerClass));
this.parmMethodName(methodStr(MaqkControllerClass, maqkMethod1));
this.parmDialogCaption('Basic SysOperation Sample');
}
public static void main(Args args)
{
MaqkControllerClass operation;
operation = new MaqkControllerClass();
operation.startOperation();
}
// The Data Contract class passed as Parameter - Whatever class is passed here becomes the Data Contract class for this controller
public void maqkMethod1(MaqkContractClass2 _maqkContract)
{
info(strFmt('SysOpSampleBasicController: %1, %2', _maqkContract.parmNumber(), _maqkContract.parmText()));
}
</pre>
Contract class 1 - just 2 members, 1 string, 1 integer
<br />
<pre class="brush: AX" name="code">[DataContractAttribute]
class MaqkContractClass
{
str text;
int number;
}
[DataMemberAttribute,
SysOperationLabelAttribute('Number Property'),
SysOperationHelpTextAttribute('Type some number >= 0'),
SysOperationDisplayOrderAttribute('2')]
public int parmNumber(int _number = number)
{
number = _number;
return number;
}
[DataMemberAttribute,
SysOperationLabelAttribute('Text Property'),
SysOperationHelpTextAttribute('Type some text'),
SysOperationDisplayOrderAttribute('1')]
public Description255 parmText(str _text = text)
{
text = _text;
return text;
}
</pre>
2nd Contract class with 1 more text variable
<br />
<pre class="brush: AX" name="code">[DataContractAttribute]
class MaqkCOntractClass2
{
str text;
int number;
str text2;
}
[DataMemberAttribute,
SysOperationLabelAttribute('Number Property'),
SysOperationHelpTextAttribute('Type some number >= 0'),
SysOperationDisplayOrderAttribute('2')]
public int parmNumber(int _number = number)
{
number = _number;
return number;
}
[DataMemberAttribute,
SysOperationLabelAttribute('Text Property'),
SysOperationHelpTextAttribute('Type some text'),
SysOperationDisplayOrderAttribute('1')]
public Description255 parmText(str _text = text)
{
text = _text;
return text;
}
[DataMemberAttribute,
SysOperationLabelAttribute('Text Property 2'),
SysOperationHelpTextAttribute('Type some other text2'),
SysOperationDisplayOrderAttribute('1')]
public Description255 parmText2(str _text2 = text2)
{
text2 = _text2;
return text2;
}
</pre>
<br />
Note the signature of the custom method (mapped to be called on startOperation() framework method). It is of the type of our data contract class, <i>MaqkContractClass2</i>. In my example, I sent the MaqkControllerClass2 class parameter. What rendered as dialog? See the following<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhiwKG0pixTRAg_RrrsHlf9S7XSbjsRsEEpIUmoXeDaDfkxj3TxsZBr5SaajpFnVB0YClgS9PpOHbrypZJtZXFz4rdgN0OvNwt5Eho_H4vrWr-PQE9cvlysad2ebkBzFY_15NWubNtnK2fL/s1600/02.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhiwKG0pixTRAg_RrrsHlf9S7XSbjsRsEEpIUmoXeDaDfkxj3TxsZBr5SaajpFnVB0YClgS9PpOHbrypZJtZXFz4rdgN0OvNwt5Eho_H4vrWr-PQE9cvlysad2ebkBzFY_15NWubNtnK2fL/s1600/02.png" height="175" width="320" /></a></div>
<br />
<br />
<br />
Changing this parameter to <i>MaqkContractClass </i>loads different dialog, notice the difference of one dialo field less below;<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg0Y70cGrFt7UIcIhzNrnN4uwOPT9UBkH4HhneTDZGyif3OLa4w6fPJpq4qwe6E4XypE2XAE9QvWEpB1eH2rj6Vji2tPr0PfZxGAO_uYadgu_wPE0XtK1apBW23E91aZrNQjZm_lRvKURuP/s1600/03.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg0Y70cGrFt7UIcIhzNrnN4uwOPT9UBkH4HhneTDZGyif3OLa4w6fPJpq4qwe6E4XypE2XAE9QvWEpB1eH2rj6Vji2tPr0PfZxGAO_uYadgu_wPE0XtK1apBW23E91aZrNQjZm_lRvKURuP/s1600/03.png" height="175" width="320" /></a></div>
<br />
<br />
<br />
Hence prooved :) Question arises, what if we give a class with no [DataContractAttribute] or [DataMember] parameter ? Answer is given below :)<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiA3mOE-l44S8185cs5U8A3ilouqSumWrAzxeJacnPPD6IBGKgRWq4_tLWO7VGxt-VP4v-rwnjUBgl_bZOA49j84vtudQB9yt3nUCvuwY7_T29GJgAJBANPR_ehxh4faTBtBpvlJrfCJ-Wt/s1600/01.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiA3mOE-l44S8185cs5U8A3ilouqSumWrAzxeJacnPPD6IBGKgRWq4_tLWO7VGxt-VP4v-rwnjUBgl_bZOA49j84vtudQB9yt3nUCvuwY7_T29GJgAJBANPR_ehxh4faTBtBpvlJrfCJ-Wt/s1600/01.png" height="256" width="320" /></a></div>
<br />
<br />
<br />
and you can press the edit method to see the internal code of how the contract class is exactly associated with the controller class ;)<br />
<br />
<br />
<br />
</div>
Anonymoushttp://www.blogger.com/profile/10820008079284038516noreply@blogger.com0tag:blogger.com,1999:blog-6535160422770359733.post-80440812984343493642014-08-19T14:48:00.001+05:002014-08-19T14:48:32.703+05:00AX 2012 - Update service schema after change in datatype length<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="text-align: justify;">
Recently I had to change, increase rather the length of a string variable in a service constituting Table. Simple thing huh. I created a new string EDT with more length and attached to the string field. My <a href="http://dotnetxperience.blogspot.com/p/mantaq-systems-pvt-limited-item-import_16.html" target="_blank">Import Utility </a>(AIF) for Items (Products) failed with the data length error.<br />
<br />
<blockquote class="tr_bq">
Invalid document schema. The following error was returned: The 'http://schemas.microsoft.com/dynamics/2008/01/documents/TableName:FieldName' element is invalid - The value 'sample value provided by API consumer' is invalid according to its datatype 'http://schemas.microsoft.com/dynamics/2008/01/sharedtypes:AxdExtType_SomeDefaultEDTName' - The actual length is greater than the MaxLength value. The actual length is greater than the MaxLength value.</blockquote>
<br />
Actually the document schema was mentioning the same old data type. I was quite sure there must be an automated way to refresh the xml schema of the related document.There is one, under Tools > AIF > Update Document Service (from IDE). This opens the 'Update document service' form<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://www.blogger.com/blogger.g?blogID=6535160422770359733" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgTTzNRY6O_QN2HUnnyoHEFncC7p3IDe2nyuvX7HAKFRGgo28mJbIXE-2CNtdklDalcor_r2-eojW9vivGJ-jNFHILFaNvZbekRDwZmV6qCQAq-oIBYFQ7_SRiK3RtNOLFwtd3ZKN2IjhIG/s1600/01_UpdateDocumentService.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgTTzNRY6O_QN2HUnnyoHEFncC7p3IDe2nyuvX7HAKFRGgo28mJbIXE-2CNtdklDalcor_r2-eojW9vivGJ-jNFHILFaNvZbekRDwZmV6qCQAq-oIBYFQ7_SRiK3RtNOLFwtd3ZKN2IjhIG/s1600/01_UpdateDocumentService.png" /></a></div>
<br />
<br />
In my case however, it created some new classes, new <a href="http://technet.microsoft.com/en-us/library/aa873749.aspx" target="_blank">Ax<Table> classes</a>. Then I refreshed AIF Services from AOT > Forms > AifService (form).<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhFdCGJuvGnyABhW8ytNjbaoJgvr_j_0QqZCh4GdtcKfB287kxkLeJ__zaoiZ0AmIRwssHrQbxFfYvUJvyGLvTpiS99eiL-3jHp0PxrSuCBQ1WvdD2CC4bFA5vGi-el5POceaLMNQQET9Sf/s1600/02_RefreshAIF.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhFdCGJuvGnyABhW8ytNjbaoJgvr_j_0QqZCh4GdtcKfB287kxkLeJ__zaoiZ0AmIRwssHrQbxFfYvUJvyGLvTpiS99eiL-3jHp0PxrSuCBQ1WvdD2CC4bFA5vGi-el5POceaLMNQQET9Sf/s1600/02_RefreshAIF.png" height="162" width="320" /></a></div>
<br />
One more thing to mention is that the new classes had bugs in them, specifically in the methods that were dealing with the cacheObject classes. Their bodies were commented for developer to write desired implementation. But this was totally out of scope for me, I removed those methods. All fine, incremental CIL generated. AIF refreshed, hit my utility > Import, same old jeopardizing error :(<br />
<br />
The schema was same old, same old shared type referenced :S. I realized that Ax<Table> class is wrapping the table, lets see there :) Yes there it is, the parm method referring to the field i changed.<br />
<table></table>
<br />
<br />
public fieldEDT parmField(fieldEDT _fieldEDT = '')<br />
{<br />
if (!prmisDefault(_searchName))<br />
{<br />
this.setField(fieldNum(TableName, FieldName), _fieldEDT);<br />
}<br />
<br />
return tableBuffer.FieldName;<br />
}<br />
<br />
<h3>
Solution</h3>
Actually this class wraps the table, and this class and its methods and meta data are used to create and refresh Document Schema. If you have to add a new field in your web service, you may add / modify the parm methods in the particular Ax<Table> class.<br />
<br />
<h3>
The BUG</h3>
Refreshing through Update Document Schema added new Ax<Table> classes. However, in the respective <a href="http://technet.microsoft.com/en-us/library/aa862063.aspx" target="_blank">Axd<Table> class</a><span id="goog_192342280"></span><span id="goog_192342281"></span><a href="https://www.blogger.com/"></a> class method (), they were not mentioned in any case. This resulted in following error;</div>
<blockquote class="tr_bq" style="text-align: justify;">
This document does not support the AxEcoResProductIdentifier class.</blockquote>
I am quite sure it was the update document schema > 'Regenerate data object classes' process bug, it should have made respective case scenarios and initialized relevant Ax<Table> classes. See below illustration<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhyoHYPzpffzLs8T_MCZYkNW7cAWcE6Xua0B2OxMsdgGrbGFBtuojZKMHXc4Z-4xrcaz_gFZEC9iOdVnQvfIYoIvs2gJt16TdO8qQaXjHAsK57qvi14o1jMzJEsr36QSCie12uect4TLKJU/s1600/03_AxdClassMethod_1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhyoHYPzpffzLs8T_MCZYkNW7cAWcE6Xua0B2OxMsdgGrbGFBtuojZKMHXc4Z-4xrcaz_gFZEC9iOdVnQvfIYoIvs2gJt16TdO8qQaXjHAsK57qvi14o1jMzJEsr36QSCie12uect4TLKJU/s1600/03_AxdClassMethod_1.png" height="164" width="320" /></a></div>
<br /></div>
Anonymoushttp://www.blogger.com/profile/10820008079284038516noreply@blogger.com0tag:blogger.com,1999:blog-6535160422770359733.post-38790662837073459412014-07-02T14:53:00.000+05:002014-07-02T15:00:07.088+05:00Reuse development of Category Hierarchy tree on table and form<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="text-align: justify;">
Use of Category Hierarchy are a great way to classify our items ad other stuff. </div>
<div style="text-align: justify;">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjUaAQ3gLf1cSW1DgQ0FH6yyaSqAA4r54eHJuUiy0WSHShbIhz5zTy5SEZlTFzpBJ8RLdfK-Lg3KxFxlCCCFliHo4OnUX_H2mhSQV2-Yj6cxQ1KUUor9HUrqn2Pmte-VkcE3eHdBk-7gqJ1/s1600/blog_categHier_01.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjUaAQ3gLf1cSW1DgQ0FH6yyaSqAA4r54eHJuUiy0WSHShbIhz5zTy5SEZlTFzpBJ8RLdfK-Lg3KxFxlCCCFliHo4OnUX_H2mhSQV2-Yj6cxQ1KUUor9HUrqn2Pmte-VkcE3eHdBk-7gqJ1/s1600/blog_categHier_01.png" height="245" width="320" /></a></div>
<br />
<br /></div>
<div style="text-align: justify;">
There can be scenarios in which you need to associate a particular entity (Item for instance) with Category Hierarchy. Once required, you will need the user to select a category (from the category hierarchy tree) against the entity which you are associating with category. </div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Generally it would mean a lot of work. Make a custom form, drop the tree control, write complete tree populating logic, on user click event pass the category RecID to the parent form and so on. But this is not the way we develop on systems that are classified under the category of ERP :)</div>
<div style="text-align: justify;">
<br />
We are suppose to reuse the existing logic to save time and effort, and extend AX rather reinventing.<br />
<br /></div>
<div style="text-align: justify;">
One of my friend, an expert in his domain ما شاء الله , <a href="http://msdax.wordpress.com/about/" target="_blank">Amir Nazim</a> helped me in this. He gave me the correct reference of a perfectly reusable solution already applied on Purchase Order (Procurement module) form.</div>
<div style="text-align: justify;">
<br />
At the very bottom, we need a primary key based relation between your table and <i>EcoResCategory table </i>(The table that actually holds the definition of each category item). Hence on <i>PurchLine</i> Table, we have a relation with <i>EcoResCategory</i> table </div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
And on <i>PurchTable</i> Form, are the two overridden methods (at DataDource > <i>PurchLine</i> ) as follows;</div>
<div style="text-align: justify;">
</div>
<ul>
<li>lookupReference</li>
<li>resolveReference</li>
</ul>
<div>
Bodies of both the methods are provided for our reference;</div>
<div>
<br /></div>
<div>
<br /></div>
</div>
<pre class="brush: AX" name="code">//lookUpReference()
return EcoResCategory::lookupCategoryHierarchyRole(
_formReferenceControl,
EcoResCategoryNamedHierarchyRole::Retail);
</pre>
<pre class="brush: AX" name="code">//resolveReference()
public Common resolveReference(FormReferenceControl _formReferenceControl)
{
return EcoResCategory::resolveCategoryHierarchyRole(
_formReferenceControl,
EcoResCategoryNamedHierarchyRole::Retail);
}
</pre>
<br />
These two methods does the rest for us that is populating the tree, displaying it as a lookup and etc. Enjoy re-usability :)</div>
Anonymoushttp://www.blogger.com/profile/10820008079284038516noreply@blogger.com1tag:blogger.com,1999:blog-6535160422770359733.post-83430094615118891842014-05-20T03:10:00.000+05:002014-05-20T10:32:43.443+05:00Transact SQL - nth day of Month (DateName)<div dir="ltr" style="text-align: left;" trbidi="on">
One of my projects wants me to identify the given date's day name (DateName) ad find its occurrence in the given month. Say today is Tuesday, 20th May 2014, and this is the 3rd Tuesday of this month.<br />
<br />
Once it is identified that the given date [20 may 2014] is 3rd Tuesday of the month, go back to last month's 3rd Tuesday, print sales data, keep going back for last 4 months and print sales data, interesting :) yet tiring too<br />
<br />
So we are going to know if today, or any given date's day (DateName) is 2nd Monday of the Month, or 4th Tuesday ? or 3rd Sunday ? or nth day of Month<br />
<br />
Just now I wrote some code to find the occurrence of day in current month. The code is not refactored for any good :D (Sorry its mid mid night and my brain cells are too short i guess). Any ways it does the trick<br />
<br />
Declare @du_date datetime, @du_date_FirstDate datetime<br />
Declare @du_date_DateName nvarchar(10), @thDayOccStr nvarchar(4)<br />
Declare @thDayOcc int<br />
<br />
Set @du_date = getDate()<br />
<br />
Select @du_date_DateName = DATENAME(dw, @du_date)<br />
<br />
Set @thDayOcc = 0<br />
Set @du_date_FirstDate = dateadd(day,1-datepart(day,@du_date),@du_date)<br />
<br />
While (@du_date_FirstDate <= @du_date)<br />
Begin<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>--** Calculate which th day it is of this month, next we will find same for last month(s) **--<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>if (DATENAME(dw, @du_date_FirstDate) = @du_date_DateName)<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>Begin<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>Set @thDayOcc += 1<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>--** FOR LOGGIN , U MAY ENABLE FOLLOWING **--<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>--Select 'Adding', DATENAME(dw, @du_date_FirstDate_Copy), @du_date_DateName, @thDayOcc<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>End<br />
<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>Select @du_date_FirstDate = DateAdd(dd,1,@du_date_FirstDate)<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
End<br />
Set @thDayOccStr = Convert(nvarchar(100), @thDayOcc)<br />
<br />
Select [Date processed] = @DU_Date, @du_date_DateName, [DateName occurence in Month] = @thDayOcc,<br />
@thDayOccStr +<br />
Case<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>When @thDayOcc = 1 Then 'st '<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>When @thDayOcc = 2 Then 'nd '<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>When @thDayOcc = 3 Then 'rd '<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>Else 'th '<br />
End<br />
+ @du_date_DateName + ' of the Month'</div>
Anonymoushttp://www.blogger.com/profile/10820008079284038516noreply@blogger.com0tag:blogger.com,1999:blog-6535160422770359733.post-62608857219211977902014-05-09T11:13:00.000+05:002014-05-09T11:17:28.235+05:00DAX: Business Connector: Pass parameters to existing methods<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="text-align: justify;">
There are tons of blog posts available on the internet guiding to use business connector for read/write operations. Most of them are dealing with how to write opening a table buffer, initializing it, setting field values (set_Field()) and then hitting the write operation.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
This is good and simple, and so is sending parameters to table / class, but I could not find the later under any relevant title, hence getting the exactly required thing difficult.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
I found my need fulfilled somewhere in Mr. <a href="https://www.blogger.com/profile/16915419684061134774" target="_blank">Corey Lasley</a>'s blog post: <a href="http://dynamics-ax-dev.blogspot.com/2010/03/using-net-business-connector-to-export.html" target="_blank">Using the .NET Business Connector to Export...</a></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
So the topic actually is about reusing existing business logic. And in doing so, you will need to call several existing, well defined, well tested Class / Table methods. And in doing so.... :D you may need to call paramater less and parameter requiring static methods.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
There are two methods inside the 'Axapta' class, 'CallStaticClassMethod' and 'CallStaticRecordMethod'. Both of them calls static methods from Class objects and Table objects respectively. The below code (.Net --> C#) excerpt provides a tutorial for calling an existing existing table method and passing parameters to it.</div>
<br /></div>
<pre class="brush: AX" name="code">Axapta ax;
AxaptaRecord objAxRec;
Object[] parm = new Object[2];
Object result;
parm[0] = "Param1Value";
parm[1] = "Param1Value";
try
{
ax = new Axapta();
ax.Logon(null, null, null, null);
result = ax.CallStaticRecordMethod("InventSum", "find", parm);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
</pre>
As you can see, an array of objects (size of method's parameter count) is assigned values and passed it as the last parameter.<br />
<br />
For classes, use 'CallStaticClassMethod'</div>
Anonymoushttp://www.blogger.com/profile/10820008079284038516noreply@blogger.com0tag:blogger.com,1999:blog-6535160422770359733.post-64646810638727443382014-02-05T12:27:00.001+05:002014-02-05T12:27:56.320+05:00AOT: Common image IDs for Action pane (EmbeddedResource & AOTResource)<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="text-align: justify;">
Often we need to make action panes and menu items on customized locations which form templates won't generate. Hence we need the icon ids for icons like new, edit, cancel, excel etc. Sure you will open a system form (Say salestablelistpage) and check their the icons and their ids. </div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
A good alternative is to have a reference table / list of all such icons you may require again to use later in such a scenario. So here it goes :)</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Common image IDs for Action pane (Embedded / AOT Resources)</div>
<div style="text-align: justify;">
<br />
<pre>NEW BUTTON GROUP
New: 11045
MAINTAIN BUTTON GROUP
Edit: 10040
Edit in grid: 10011
Cancel (document): 10406
Delete: 10121
COPY GROUP
Copy: 12475
Copy Lines: 12218
OTHERS
Summary (calc): 10832
Print Mgmt: 10698
Line Quantity: 12415
Trade Agreement: 12430
Cases: 11229
Document confirmation: 10511
Line Amounts: 12458 (11038)
LIST GROUP
Send to Excel: 10156
Refresh: 11437
ATTACHMENTS GROUP
Attachments: 10442
Generate from Template: ImageResourceOfficeTemplate_ico [AOTResource]</pre>
<br />
<br /></div>
</div>
Anonymoushttp://www.blogger.com/profile/10820008079284038516noreply@blogger.com0