Posts

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

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

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

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

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

Dynamics AX: Remove Empty Code Block Warnings

A X is very picky about having SOMETHING to do inside of a code block.  For example, the compiler will issue the warning "Empty compound statement." when compiling the following code: boolean bob; try {      //fancy code here } catch { } //warning here If you want to suppress this error, you can call Global::exceptionTextFallThrough() method.  This method does absolutely nothing (right click and go to definition to see for yourself), but it does satisfy the compiler enough to remove the warning. boolean bob; try {      //fancy code here } catch {      //This does nothing but suppress the warning       Global::exceptionTextFallThrough(); }