-->

AX 2012 R2: Prevent startup of checklists

maqk® by MAQ Khan | 3:31 PM

AX 2012 R2: Model upgrade check list does not disappear



Subject

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.


Audience

Dynamics AX 2012 (FP, R2 R3) X++ Developers, Technical consultants, Functional consultants, and advanced users.


Background

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



Problem

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.


Checklist Framework

There is a solution provided by the framework. It is the menu item provided in the Checklist section. The full navigation is: /System administration/Area page/Setup/Checklists/Prevent startup of checklists


What it does ?


Points to Action menu item: SysCheckList_InitNoUpdate
Which then calls the SysCheckList class with the base enum: SysCheckListType and SetDB as selected value. 
The main method for this base enum value provided runs the following
                case SysCheckListType::SetDB :
                    SysCheckList::initNoUpdate(true);
                    return; //mark upgrade and setup as finished



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

SysCheckList::initNoUpdate() method body


A failed attempt


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.

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


Solution


SysCheckList_Update::finalizeMinorUpgrade();

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.

This method actually does similar things discussed above along with deleting unwanted records from SysSetupLog table and updating the ReleaseUpdateConfiguration table. However, it does it fully and bring results.

Links


  • http://dynamicsuser.net/forums/p/76421/421256.aspx 

#AX7SERIES: Some basic terminologies and concepts

maqk® by MAQ Khan | 12:18 PM

Terminologies and Concepts

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.


This post will be used as a reference post for the next posts coming in  #AX7SERIES


Elements: 

Any AOT element like form or table (similar to AX2012)


Projects: 

Logical grouping of AOT Elements (similar to AX2012)

Models:  

Grouping of elements representing distributable software solution. One element can only exist in one model, not the other. Design time concept


Packages: 

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


#AX7SERIES: Power of Visual Studio

maqk® by MAQ Khan | 5:53 PM

#AX7SERIES: Power of Visual Studio IDE



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 



Audience

AX 7 enthusiasts, Dynamics AX 2012 (FP, R2 R3) X++ Developers, Functional and Technical consultants and advanced users



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

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"

Categorization of AOT Items

IDE provides two ways or views to see and access AOT Items


Classic view

Same old way (new color scheme due to whole new IDE though :P) illustrated as follow
AOT - Classic view


Model View

Provides a list of Models stored as default by the installation along with new models created by devs.

New option, 'Model view'

AOT in Model view

Search AOT Items

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

Search in AOT - excellent!


Saving development items on local machine

Yes sir, in #AX7, you code gets saved in your local folder. You sync with AOS at later stage perhaps.
Save projects at local drive

Code windows and tabs: Beautifullll

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
One tab for all code belonging to a class, form or table

Enjoy links section as cool as ever

 Links


  • Link 1
  • Link 2
  • Link.... n

AX 7: #AX7SERIES X++ Devs welcome To Visual Studio

maqk® by MAQ Khan | 2:01 PM

#AX7SERIES: Welcome To Visual Studio



Subject

This post is the first on the series of AX7 which will feature introduction and the underlying changes



Audience

Visual Studio developers, Dynamics AX 2012 (FP, R2 R3) X++ Developers, Technical consultants and advanced users


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. 

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.

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.

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

AX7 Development - Visual Studio requirements


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.

BY THE WAY Enjoy some cool links in the end


Links


AX 2012 X++: Add N working days to a date

maqk® by MAQ Khan | 5:04 PM

AX 2012 X++: Add N working days to a date

This post provides a few tips, specially focusing the working calendar and working days


Audience: Dynamics AX 2012 (FP, R2 R3) X++ Developers, Functional and Technical consultants and advanced users


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.

AX also has alot of such reusable method to save time and keep consistency. A few are listed below;


  • DateTimeUtil: A date time manipulation utility class. Some of its methods are referenced below too
  • DateTimeUtil::getSystemDateTime(): Works like a Now() method
  • DateTimeUtil::addMonths(): Add n months to the provided date
  • dayOfMth(date): Calculates the number of the day in the month for the specified date.
  • mkDate(int month, day, year)Creates a date based on three integers, which indicate the day, month, and year, respectively.
  • prevYr(date) - Retrieves the date in the previous year that corresponds most closely to the specified date. Similar functions include prevMth() and prevQtr()
  • dateMthFwd(date, int qty): Adds the specified number of months to a date.

These all methods are so useful and handy while there are much more to mention. See links section for more.

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.


WorkCalendarSched.schedDate Method

This sweet method in short takes from date, no of days to add, scheduling direction, calendar id to process against and calendar days flag to schedule the resulting date, awesome. Exactly what I was looking for. Hence using this method, we can add N working 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

Code sample


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)    ));  
}


Output is shared as follows


 Links

ProjUnpostedTransView-Field WorkerName is not compatible with field WorkerName

Subject


This post provides insight about a synchronize error received during full AOT for AOT view 'ProjUnpostedTransView' and its resolution.

Error

ProjUnpostedTransView: Synchronize database There is a field mismatch in the union query. Field WorkerName is not compatible with field WorkerName.

Audience:  Dynamics AX 2012 (FP, R2 R3) X++ Developers, Functional and Technical consultants and advanced users

Background

We have been facing this issue since day one of our installation of AX 2012 R3 (RTM). Build numbers are as follows;

Microsoft Dynamics AX 2012 R3 (RTM)
Kernel version: 6.3.164.0
Application version: 6.3.164.0

Problem

When synchronizing the full AOT, the following errors come






followed by...

Solution(s)

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.


  1. ProjLedgerJournalTransUnpostedView
  2. TrvExpTransDistributionsUnposted
  3. ProjJournalTransFeeUnpostedView
  4. projCustInvoiceLineDistsUnpostedView
  5. ProjJournalTransHourUnpostedView
  6. ProjProdJournalRouteUnpostedView
  7. InventJournalTransUnpostedView
  8. ProjProdJournalBOMUnpostedView
  9. VendInvoiceInfoLineDistributionsUnposted
  10. ProjOnAccTransUnpostedView
  11. ProjIntercompanyUnpostedExpView
  12. TSUnpostedTimesheetLinesAllView
  13. ProjIntercompanyUnpostedTSView
  14. ProjIntercompanyUnpostedVendInvLineView
Data sources (Views) with mismatching EDTs in their field, WorkerName




Each of these views comprise of one or more tables. And each of these views as a data source has the HCMWorker data source with in further relating to DirPartyTable 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, "Name" which was different from what is returned from DirPartyTable Name field which extends "DirPartyName" extended type.  

Data sources with inconsistent extended types

  1. projCustInvoiceLineDistsUnpostedView
  2. ProjProdJournalBOMUnpostedView
  3. ProjInventJournalTransUnpostedView
  4. ProjOnAccTransUnpostedView

Due to this EDT mismatch, the AOT framework was giving errors.

Providing the correct extended type of DirPartyName to the WorkerName fields for each of these views made the schema fully consistent, hence error removed.

NOTE: These corrections are to be made in each view used as a datsource and in the field section

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.

Thanks :)

AX 2012: FormRun.createRecord Method with example

maqk® by MAQ Khan | 10:24 AM

AX 2012: FormRun.createRecord Method with example

This post provides a tutorial about the FormRun.createRecord Method which is override able at form level for custom implementation

AudienceDynamics AX 2012 (FP, R2 R3) X++ Developers, Functional and Technical consultants and advanced users

Background

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. 

Question: Where is the InstanceRelationType field set to identify the record belonging to a child table.

Thanks to Nasheet Siddiqui | blog 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().

Example

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. 

createRecord() implementation at PurchAgreement form

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 
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.

For even better understanding of concepts, I am attaching this valuable excerpt

An excerpt from Inside Dynamics AX 2012

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.

Links

top