Posts

D365 For Operations - Upgrade your existing build definition and how to blacklist models in deployment packages

Image
U pdate: Since writing this post, Microsoft has updated their own documentation on how to achieve blacklisting models in the build.   The article can be found here . The Dynamics 365 for Operations Wiki is a great place to gather information about new features and technical documentation for D365.  For example, this page has information on what is new in each of the the Update package. Over the course of the periodic updates, the build definition has added several new features such as automatically updating version number of your models to match the build definitions version number, or allowing blacklisting of models in your deploy-able package (the scope of this post). This is an important new feature, especially for those projects who are utilizing the excellent unit testing framework in D365 (which you should be!).  For example, you most certainly want your unit tests to be build and run as a part of your continuous integration strategy, but when it comes time to generate

Dynamics AX 2012 - Visual Studio Team Services Custom Work Item Fields Break Version Control (Error TF237121)

Image
W e've been using Visual Studio Team Services  (VSO) on several projects as or project management and version control solutions for Dynamics AX successfully for several years.  Recently though, AX occasionally presents us with one of these gems when logging into the client: "TF237121: Cannot complete the operation. An unexpected error occurred." and "Failed to update metadata cache. (Object Model)". You may have seen this error before.  Generally, from my experience, this coincides with an update that Microsoft has pushed to VSO. The fix is generally quite simple:  Navigate to C:\Users\[Your User]\AppData\Local\Microsoft\Team Foundation\3.0\Cache and delete all the files in that directory.  You may see several versions; 3.0 is the version AX 2012 R3 uses. Upon clearing the cache and restarting the AX client, the issue goes away and you can happily version control again. However, a few days ago, this fix stopped working for us.  No matter how much I

Dynamics AX 2012 - The Find dialog and searching for special characters such as double colon "::"

Image
T he Find feature in AX 2012 is an extremely useful tool, but it can be a bit tricky to use, especially when searching for text with special characters. One common example is using the Find function to find all the instances in code where a specific enumeration value is used. Ideally, once would just enter the value, such as in the following screenshot. Unfortunately, the above search will return no results.  Unintuitively, special characters (such as the double colons "::") must be escaped with a back slash in order for them to be treated as literal string characters.  The following search produces the desired results. Other special characters (such as < and >, among others) must also be escaped in this way.  This is because the Find dialog uses regular expressions, which in itself opens up a many options for customizing your search. In fact, the search algorithm uses the AX  match()  function behind the scenes to resolve the search.  Details about the Re

Dynamics AX SysFileDeployment Framework - Deploy files automatically (using resources) to the client on login

Image
S ometimes when creating a customization in AX, external files are required to make things happen.  External graphics files, XML or even DLL's may be required by the AX client. For example, a recent customization for my company required a control in AX to drag-select areas of a PDF document, so the user could tell the system where relevant information is located on the document.  AX is far too limited to satisfy this requirement with native UI controls, so I created a .NET managed user control to complete the task.  This control (DLL file) is required to be installed on each client before the form that uses it can be loaded. Herein lies the problem. If your company has only one or two clients connecting to the AOS server, you may be able to just install these missing components manually.  However, when you have hundreds of clients connecting to your server, this quickly becomes a maintenance nightmare of ensuring clients are up to date. The SysFileDeployment framework in AX

Dynamics AX - AIF, Using Asterix (wild card character) in an Criteria Element Find method

Image
W hen consuming AIF services via c#, a common ask is can we write a query similar to a Like statement in SQL. Statements like this one should be possible: (C#) var criteriaElements = new AXCSICustomer.CriteriaElement[1]; criteriaElements[0] = new AXCSICustomer.CriteriaElement(); criteriaElements[0].DataSourceName = "DirParty"; criteriaElements[0].FieldName = "Name"; criteriaElements[0].Operator = AXCSICustomer.Operator.Equal; criteriaElements[0].Value1 = " *bob* "; var queryCritieria = new AXCSICustomer.QueryCriteria() {     CriteriaElement = criteriaElements }; While you can use the '?' wildcard in the  value, AX will strip any other special characters (specifically *",.()<>!= characters).  This happens in the class SysQuery::value() method in AX. One workaround, as found here , is to use the GreaterOrEqual operator.  This essentially turns the query into a "starts with" statement. (C#) criter

Dynamics AX - Enumerate subclasses of a specific class

A colleague of mine recently asked me if there was a quick way to find all of the classes that extend a certain base class. "But of course there is!" I said.  Here is the code block I sent him, should you, dear reader, need to accomplish a similar task. static void getSubclasses() {     List            subclassList;     ListEnumerator  listEnumerator;     SysDictClass    dictClass;     dictClass       = new SysDictClass(classNum(ExchangeRateProvider)); //Your class here     subclassList    = dictClass.extendedBy();     if (subclassList.elements())     {         listEnumerator = subclassList.getEnumerator();         setprefix(strfmt("%1 is extended by %2 subclasses", dictClass.name(), int2str(subclassList.elements())));         while (listEnumerator.moveNext())         {             info(ClassId2Name(listEnumerator.current()));         }     }     else     {         info(strfmt("%1 is not subclassed", dictClass.name()));     } }

Dynamics AX - A-Job Actions not being generated for a Channel after restoring databases

A fter restoring the model and data databases in AX, the A-Jobs that were working on the environment I migrated from and were not working on the new environment. Specifically, actions were not being generated for the store I was using for the preaction of changing a released product's discount flag (retail fast-tab). Turns out, it's the distribution locations (Retail -> Setup -> Retail Scheduler -> Distribution Locations) that were cached in the Global Object Cache not matching.  Deleting and re-creating the distribution locations fixed the issue. I suspect also clearing the global object cache would have done the trick. See: http://msdn.microsoft.com/en-us/library/hh608239.aspx