Display Method usage in Invoice Batch Job Criteria AX 2012

  • Display Method usage in Invoice Batch Job Criteria AX 2012

    Posted by dan-cantley-1 on February 27, 2019 at 1:51 pm
    • Dan Cantley

      Member

      February 27, 2019 at 1:51 PM

      ?#AX2012
      I created a Display method attached to the SalesTable.Ā  First one I have done.Ā  I added it to the grid in SalesTableListPage to test it outĀ and it works great.??

      Now I want to add it to a Batch Job for invoices as one of the field to use in the selection criteria for the SalesTable.Ā  I tried to find it in the discussions, but when not knowing what key words to search on for this, it can be a little hard to figure it out.

      I was hoping that adding the display method to the salesTable would be it, but I am guessing there is more to it than that, because when I bring up the search criteria in the Invoicing batch job and bring up the salesTable, it isn’t one of the fields I can select.

      Can someone point me in the correct direction please?Ā  Is there a Class I need to add to, or a query to get this as one of the fields?

      It is probably an easy thing to setup, once you know the correct way to do it, but finding that correct way can be a pain.

      Thanks,

      ——————————
      Dan Cantley
      Systems Analyst
      Bedrock Manufacturing Co, LLC
      Detroit MI
      ——————————

    • Michael Gonzalez

      Member

      February 27, 2019 at 2:50 PM

      I ran it by one of my experts.Ā 

      Display methods can’t be used as fields in the search criteria in batchJobs but it’s possible create your own parameters in your Batch Job, and use similar logic in your custom parameters
      1. Use runBaseBatch class Ā Ā  Ā Refer to: https://docs.microsoft.com/en-us/dynamicsax-2012/developer/walkthrough-extending-runbasebatch-class-to-create-and-run-a-batch Ā Ā  Ā Don’t forget override the pack method for saving parameters. Ā Ā  Ā Refer to Pack-Unpack Design Pattern: https://docs.microsoft.com/en-us/dynamicsax-2012/developer/pack-unpack-design-pattern Ā Ā  Ā  2. Modify you class to add Parameters Ā Ā  Ā Override the dialog method. Ā Ā  Ā Override the getFromDialog method. Ā Ā  Ā  3. It’s possible to generate custom parameters with advanced logic
      protected Object dialog() { Ā  Ā  Object ret; Ā  Ā  FormStringControl Ā  Ā  Ā  Ā  Ā  control;
      Ā  Ā  ret = super();
      Ā  Ā  control = myDialog.control(); Ā  Ā  control.registerOverrideMethod(methodStr(FormStringControl, myCustomLookup).. Ā Ā  Ā  Ā  Ā  return ret; } Ā Ā  Ā Refer to: https://docs.microsoft.com/en-us/previous-versions/dynamics/ax-2012/system-classes/gg850443(v=ax.60)
      4. Create the body of the custom LookUp Ā Ā  Ā  public void myCustomLookup(FormStringControl _control) { Ā  Ā  Query Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  query = new Query(); Ā  Ā  QueryBuildDataSource Ā  Ā queryBuildDataSource; Ā  Ā  QueryBuildRange Ā  Ā  Ā  Ā  qbr; Ā  Ā  SysTableLookup Ā  Ā  Ā  Ā  Ā sysTableLookup = SysTableLookup::newParameters(tableNum(SalesTable), _control);
      Ā  Ā  sysTableLookup.addLookupField(fieldNum(SalesTable, FieldName));
      Ā  Ā  queryBuildDataSource = query.addDataSource(tableNum(SalesTable)); Ā  Ā  qbr = queryBuildDataSource.addRange(fieldNum(SalesTable,… Ā  Ā  qbr.value(..
      Ā  Ā  sysTableLookup.parmQuery(query);
      Ā  Ā  sysTableLookup.performFormLookup(); }

      ——————————
      Michael Gonzalez
      Account Executive
      Dynamics Resources
      Venon Hills IL
      ——————————
      ——————————————-

    • Dan Cantley

      Member

      February 28, 2019 at 7:12 AM

      Thanks – this is what I was looking for – guess it couldn’t be as easy as creating a display method.Ā  I will try it out and let you know if it solves.Ā  Now I just need to find the proper class for the Invoice Batch.

      ——————————
      Dan Cantley
      Systems Analyst
      Bedrock Manufacturing Co, LLC
      Detroit MI
      ——————————
      ——————————————-

    dan-cantley-1 replied 7 years, 4 months ago 1 Member · 0 Replies
  • 0 Replies

Sorry, there were no replies found.

The discussion ‘Display Method usage in Invoice Batch Job Criteria AX 2012’ is closed to new replies.

Start of Discussion
0 of 0 replies June 2018
Now

Welcome to our new site!

Here you will find a wealth of information created for peopleĀ  that are on a mission to redefine business models with cloud techinologies, AI, automation, low code / no code applications, data, security & more to compete in the Acceleration Economy!