Calling Reports From Button

billnavbillnav Member Posts: 3
Hi,

I would like to call a report from a menu Item in the Item Card. I add a menu Item in the Item Card. I put the action property to 'Run Object' and I select my report in the property Run Object. It works fine, but I would like that my report filter on the current Item of the Item Card. Is it possible to do it if my licence does not allow me to write C/AL Code in form.

Thanks

Bill

Comments

  • SavatageSavatage Member Posts: 7,142
    you want somthing similar to what they have on an invoice for example.

    You are looking at an invoice & when you click print - that inv# is already filled in for you.

    Unfortunately the Command button Has a RunFormLink but not a RunReportLink.

    What makes report like the invoice work is the Codeunit Document-Print #229 and with a regular license I do not think you will be able to achieve this. :-k
  • billnavbillnav Member Posts: 3
    You did understand my problem! But I'm sad about the answer ;) It is frustrating to be limited like that!

    Thank you Savatage!

    Bill
  • SavatageSavatage Member Posts: 7,142
    I needed to run a report (#50065) from a PO that would update some sales lines. All I wanted is that the PO# appeared in the report so no user intervention was needed.

    The only way I could do it was on the c/al code of the button
    OnPush()
    DocPrint.UpdateSalesLines(Rec);
    

    then I added to Codeunit229 (Document-Print) a function called UpdateSalesLines
    But it's the last 3 lines of code that gets your report going & without a dev license you would need to have your nsc do this for you.

    UpdateSalesLines(PurchHeader : Record "Purchase Header")
    PurchLine.RESET;
      PurchLine.SETRANGE("Document Type",PurchHeader."Document Type");
      PurchLine.SETRANGE("Document No.",PurchHeader."No.");
      PurchLine.FIND('-');
      PurchHeader.GET(PurchHeader."Document Type",PurchHeader."No.");
      COMMIT;
    
    ReportSelection.SETFILTER("Report ID",'<>0');
    ReportSelection.FIND('-');
    REPORT.RUNMODAL(50065,TRUE,FALSE,PurchLine);
    
  • SavatageSavatage Member Posts: 7,142
    i would find a RunReportLink property in a command button very useful too! [-o<

    Helloooo Dynamics-Nav DEV Team!!!
Sign In or Register to comment.