D365 Retail

Field notes on Dynamics 365 Commerce & Retail

All articles
X++Retail Layout

Writing a Test Job in AX7: The Like Operator and Bulk-Updating Retail Screen Layout Buttons

26 January 20182 min readHitesh Manglani

Three things in one post: how to run a test job in AX7, how the like operator differs from AX 2012, and a job that saves you from manually editing Retail Screen Layout buttons one at a time.

Running a job in AX7

In AX 2012, this was an AOT Job node. In AX7, the Jobs node is gone — a job is just a public class with a static Main method:

public class TestJob
{
    public static void main(Args args)
    {
        // runnable code goes here
    }
}

The public access specifier on the class is required in AX7; it wasn't in AX 2012. For the full steps to create and run one, see Get started developing in AX 7.

The like operator

AX uses * as a wildcard, not SQL's %.

Bulk-updating Retail Screen Layout buttons

Editing button colors one at a time in the Retail Screen Layout designer is slow. If you need to change the same property across many buttons — say, while prepping a demo and trying out different button colors — a job with update_recordset does it in one shot:

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*';
    }
}

Note the like '*ABC*' — this is the wildcard from above, matching every button grid whose ID contains ABC.

This bulk-update approach is fine for scenarios like demo prep. For a real data migration, use DIXF instead.

Running the job successfully updates every matching button grid:

Job result

So with this code you don't need to go to each button grid in the layout and change properties manually — you skip having to see this screen over and over:

Editing a Retail Screen button grid manually

More on this topic

Stuck on a D365 Commerce issue?

If you need hands-on help with MPOS, CRT extensions, or a Retail deployment, get in touch — I still build these things.

Talk to me