Writing a Test Job in AX7, Use of Like Operator and Bulk Update of Retail Screen Layout Button Properties

The following post will touch base on-

1. How we can execute a test job in AX7 which most of us already know in the good old AX 2012 as an AOT Node.

2. Use of ‘like’ operator-  AX uses asterik ‘*’ character instead of ‘%’ which we use in SQL.

3. Changing Layouts of Retail Screens need not be tedious and time consuming by changing properties of each button manually.

A job in AX7 is simply a public class and it must have a main method that provides the runnable code. The main method was required in AX 2012 too but there was no need for the class to have access specifier as public.  Another difference is that the Jobs Node in AOT is deprecated.
So how do we write a test job in AX7? you can start by referring to this link for steps to create one
Consider that you want to bulk update the properties of buttons in the Retail Screen Layouts. The below piece of code can help to do the bulk update in a matter of few minutes,  <Update> please note this method of bulk update is ideal in some scenarios like preparation of demos  where you want to try out different values of colors for the buttons for example. However usual  approach for bulk update is DIXF https://docs.microsoft.com/nb-no/dynamics365/unified-operations/dev-itpro/lifecycle-services/ax-2012/migrate-data-dixf</Update>
Note the use of like Operator (*) in this code.

 

class TestJob

{

    public static void Main(Args args)

    {

        RetailButtonGridButtons retailButtonGridButtons;

        update_recordset retailButtonGridButtons

            setting BackColor=-65536,

                    BackColor2=-65536,

                    FontColor=0

        where retailButtonGridButtons.buttonGridId like ‘*ABC*’;

    }

}

On running the above code we get following screen on successful completion

 So with this code you dont need to go to each Button Grid in the layout and change properties manually. So you can save your time and skip having to see the following screen multiple times

 Note – This post was first published in TechTalk

-Hitesh Manglani

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s