CRM2016 , SQL2016
Firstly, apologies if this is posted in the wrong forum, I'm not sure if it's a CRM / Plugin issue or SQL/SSRS issue
I have generated a SSRS report with a parameter, and can view that report in the report designer with no problems. I have created a plugin that generates a pdf of that report and saves it to file. This is where the problem starts. The pdf report is generated, but no data is retrieved from crm. I cannot see any errors for the plugin, so am at a complete loss as to where to look. I have even retrieved the value for the parameter from SQL and hard coded I in .. still nothing
Code
PublicSharedFunction GeneratePDFReport(ReportType AsInteger, ReportId AsString, serviceprovider AsIServiceProvider) AsBoolean
Const FILEPATH AsString = "C:\Temp\Reports"
Const REPORTURL AsString = "xxxx/.../reportexecution2005.asmx"
Const INPUTREPORT AsInteger = 1
Using ReportError AsStreamWriter = NewStreamWriter("C:\Temp\Reports\Errors.txt")
Try
' Genetic COde
Dim objRSExec AsNew ReportServer.ReportExecutionService
Dim objReportID AsNew ReportServer.ParameterValue
Dim strFileType AsString = "PDF"
Dim strFileExtension AsString = ".pdf"
Dim strFullPathName AsString = String.Empty
Dim objResult() AsByte
Dim objStream AsFileStream
SelectCase ReportType
Case INPUTREPORT
' Add your code here INPUT REPORT
Dim objParams(0) As ReportServer.ParameterValue
' strFullPathFileName = Licence + ReportType + BACSReportID
strFullPathName = FILEPATH & "\INPUT REPORT"& strFileExtension
' TEST REPORTID 1421038D-C89B-E611-80CE-00155D011B03
With objReportID
.Name = "Reportid"
.Value = "1421038D-C89B-E611-80CE-00155D011B03"
objParams(0) = objReportID
EndWith
With objRSExec
.Credentials = System.Net.CredentialCache.DefaultCredentials
.Url = REPORTURL
' Load Report Name
.LoadReport("/BureauOps_MSCRM/Bacs Input Report - AutoGenerate", Nothing)
.SetExecutionParameters(objParams, "en-us")
objResult = .Render(strFileType, Nothing, strFileExtension, Nothing, Nothing, Nothing, Nothing)
EndWith
objStream = File.Create(strFullPathName, objResult.Length)
With objStream
.Write(objResult, 0, objResult.Length)
.Close()
EndWith
EndSelect
Catch ex AsException
ReportError.WriteLine(ex.Message.ToString)
ReturnFalse
EndTry
EndUsing
ReturnTrue
EndFunction
EndClass
any suggestions?