Options

Auto populate field?

yuppicideyuppicide Member Posts: 410
edited 2014-11-19 in Navision Attain
When I RunObject from a MenuButton is there a way to auto populate data?

Example: When I am on a Sales Order and go to print Sales Order it auto populates "No." field with the number of the current order you're working with.

I added a my own report to the Print MenuButton, but when it populates "No." it uses the last number I used, not the number you're actually trying to print. Any way to make that work?

Example: I am on Sales Order S135150, but when I go into to print my report S134870 shows up.

Comments

  • Options
    tinoruijstinoruijs Member Posts: 1,226
    You could take a look at how standard NAV does this and for example examen function PrintSalesOrder in codeunit 229 Document-Print.
    But an easier solution can be this:
    CLEAR(reportname);
    localrecord.SETRANGE("No.", "No.");
    reportname.SETTABLEVIEW(localrecord);
    reportname.RUNMODAL;
    

    Where localrecord is Sales Header in your case.

    Tino Ruijs
    Microsoft Dynamics NAV specialist
  • Options
    yuppicideyuppicide Member Posts: 410
    Too bad I don't have the license to change Codeunits. Oh well.
  • Options
    tinoruijstinoruijs Member Posts: 1,226
    yuppicide wrote:
    Too bad I don't have the license to change Codeunits. Oh well.
    Can you change pages?
    This you can add to your page:
    CLEAR(reportname);
    localrecord.SETRANGE("No.", "No.");
    reportname.SETTABLEVIEW(localrecord);
    reportname.RUNMODAL;
    

    Tino Ruijs
    Microsoft Dynamics NAV specialist
Sign In or Register to comment.