Running reports from PowerShell

lars_lindlars_lind Member Posts: 3
edited 2015-08-17 in NAV Three Tier
Hi,

I'm trying to run a report from a codeunit started with Invoke-NAVCodeunit from PowerShell. But I get the following error:
Invoke-NAVCodeunit : Microsoft Dynamics NAV Management Server attempted to issue a client callback (Report - Chart of Accounts(1)). Client callbacks are not supported on Microsoft Dynamics NAV Management Server.

I can run the codeunit from the Development Environment and from the Job Queue without problems (The Chart of Accounts is printed). And when running from the Development Environment no Request Dialog was shown.

And if I choose a processing-only report, it also works from PowerShell.

My codeunit contains only one line of code:
REPORT.RUN(1, FALSE, FALSE);

I have also tried with the SystemPrinter parameter set to TRUE. And specifying the printer for the report in Printer Selections also did not solve the problem.

I have tried on both NAV 2013 R2 and NAV 2015 with the same result.

Are there anyone who have an idea of how I can make this work?

Best regards,
Lars

Comments

  • yukonyukon Member Posts: 361
    Hi,

    I believe report error is coming from "Printing" dialog. No matter you use "REPORT.RUN(1, FALSE, FALSE);" but windows auto showing the "Printing" dialog box. I didn't try on powershell to run report. I did test on WS and fail. But Navision 2015 is introduce new function Report.Print https://msdn.microsoft.com/en-us/library/dn762337%28v=nav.80%29.aspx. I did test with WS and work.

    Hope this info help to you.

    Regards,
    Yukon
    Make Simple & Easy
  • lars_lindlars_lind Member Posts: 3
    @yukon: Thank you for the suggestion. I had not discovered this new function. But unfortunately does REPORT.PRINT give the same error as before when called from PowerShell.

    I may have to do some workaround using REPORT.SAVEASPDF, and then print the resulting file from PowerShell.

    Regards,
    Lars
Sign In or Register to comment.