Thursday, July 22, 2010

There are number of requirements when a developer wants to change the label of runbase dialog OK button in Dynamics AX. You can use the following code to change the label of OK button on Runbase dialog in AX

Insert the following code after the super() call in the putToDialog method

Tuesday, July 20, 2010

Lets say you have a requirement in which you want to show multiple tabs on a lookup form. For example, you have a field in which you want your user to either select a customer or vendor from a lookup then this could be the best option to show multiple tabs and let user select either customer or vendor.

Following are the steps to get this done.

* Create a new form "LookupForm" with multiple tabs on it.
* The FormHelp property of the EDT should be set to the form you just created "LookupForm".
Its all done!!! this is how lookup will look like

No we can play with our query
Find all records where either the ItemType is Service, or the ItemType is Item and a barcode exists. The join criteria is only applied in the second half of the expression, so all Service items will appear irrespective of whether they have a bar code. Again, this is not possible to achieve using the standard query ranges.

Lets find the record where the value of ItemId field is B-R14. Take note of the single quotes and parenthesis surrounding the entire expression. queryBuildRange.value(strFmt('(ItemId == "%1")', queryValue("B-R14")));

Find records where the ItemType is Service. Note the use of any2int().queryBuildRange.value(strFmt('(ItemType == %1)', any2int(ItemType::Service)));
Find records where the ItemType is Service or the ItemId is B-R14. Note the nesting of the parenthesis in this example. queryBuildRange.value(strFmt('((ItemType == %1) || (ItemId == "%2"))', any2int(ItemType::Service), queryValue("B-R14")));

Find records where the modified date is after 1st January 2000. Note the use of Date2StrXpp() to format the date correctly. queryBuildRange.value(strFmt('(ModifiedDate > %1)', Date2StrXpp(01012000)));

Complex criteria with combined AND and OR clauses
We need to find those records where the ItemType is Service, or both the ItemType is Item and the ProjCategoryId is Spares. This is not possible to achieve using the standard range syntax.
Note also that in this example, we are using the fieldStr() method to specify our actual field names and again, that we have nested our parenthesis for each sub-expression.

Saturday, July 3, 2010

Many developers often stuck while they try to apply range to the dynamics ax query to filter records based on some conditions. We will try to explore the query ranges in this article and will try to play with some examples to learn how we can apply query ranges using x++ to the Dynamics AX queries.

Let's say we want to apply "OR" range on a SAME field then we have 2 ways to do it.

Note: We have used DataAreaId field above to apply the range however, the actual range is on AccountName and AccountNum field. This means when you use range value expressions you can use any field to obtain range object and use it to insert your range in the query. Using DataAreaId field for this purpose is the best practice.