web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Create SSRS Report from Custom Workflow

(0) ShareShare
ReportReport
Posted on by 1,703

CRM2016  On-Premises

I have spent hours on this and need help understanding what the real issue is.

I created a SSRS repot in VS2015 and uploaded it into CRM and published it for external use

I crated a workflow in Vb.net to call the report and create a PDF via a web service.

In CRM ( signed on as a domain admin ) , I execute the workflow but always get an error in reporting services log 'User not found' ( log below )

1. the report is in fetch xml

2. logged into Reporting services as Domain\Admin , I can execute the report fine

3. logged into CRM as Domain\Admin  I can ruin the report fine from the reports area.

4. The workflow was generated by vs2017 but on a different domain. The web service connects using Domain\Admin credentials and can be previewed in VS with he correct data 

I'm at a loss as to what or where the issue is 

The error is 

Microsoft.Crm.CrmException: An unexpected error occurred.
Microsoft.Crm.CrmConfigObjectNotFoundException: User Was Not Found ---> Microsoft.Crm.Reporting.DataExtensionShim.Common.ReportExecutionException: An unexpected error occurred. ---> Microsoft.Crm.Reporting.DataExtensionShim.Common.ReportExecutionException: User Was Not Found

 

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    crm development Profile Picture
    870 on at

    Hi, try to disable the current user and re-add the user to CRM.

    Thanks,

    Anand

  • Suggested answer
    Kokulan Profile Picture
    18,054 on at

    Hi

    Could you share a bit more detail on how your external service is generating PDF?

    It looks like at the point where the the report is being run, the SSRS is not able to locate the user as CRM user.

    Most likely that your Web Service App Pool account is not a CRM user.

    And also just wanted to mention that  to generate PDF from report, you can use the Reporting Service Web Service and ask it to render as PDF, you do not need seperate service for this, please see below

    www.akaes.com/.../ms-dynamics-crm-2013-generating-ssrs-report-as-pdf-using-plugin

  • Suggested answer
    Dynamics365 Rocker Profile Picture
    7,755 on at

    Domain of report and workflow should be same.

    It will be better if you share your code in which you render report.

  • Pete_N Profile Picture
    1,703 on at

    I thought it may me a domain issue. luckily I'm doing this on a laptop, so I will try again after I have changed the domain . Just for your amusement,  my code

                   Try

                       Dim result As Byte() = Nothing

                       Dim rs As New VMReportServer.ReportExecutionService()

                       ' Credential to connect with CRM

                       rs.Credentials = System.Net.CredentialCache.DefaultCredentials

                       ' Setting the URL of the Reporting Server

                       Dim reportPath As String = "/XXX_MSCRM/Facilities Management Pre-processing Report"

                       ' Prepare report parameter.

                       Dim parameters(0) As VMReportServer.ParameterValue

                       parameters(0) = New VMReportServer.ParameterValue()

                       parameters(0).Name = "reference"

                       parameters(0).Value = _ProcessReference

                       Dim format As String = "PDF"

                       Dim historyID As String = Nothing

                       Dim devInfo As String = "<DeviceInfo><Toolbar>False</Toolbar></DeviceInfo>"

                       Dim encoding As String = Nothing

                       Dim mimeType As String = Nothing

                       Dim extension As String = Nothing

                       Dim warnings As Warning() = Nothing

                       Dim streamIDs As String() = Nothing

                       Dim execInfo As New ExecutionInfo()

                       Dim execHeader As New ExecutionHeader()

                       rs.ExecutionHeaderValue = execHeader

                       execInfo = rs.LoadReport(reportPath, historyID)

                       rs.SetExecutionParameters(parameters, "en-us")

                       Dim SessionId As [String] = rs.ExecutionHeaderValue.ExecutionID

                       result = rs.Render(format, devInfo, extension, encoding, mimeType, warnings, streamIDs)

                   Catch expdf As Exception

                       Globals.clsGlobals.WrtietoErrorLog("Create PDF  ERROR " & expdf.Message.ToString)

                   End Try

  • Verified answer
    David Jennaway Profile Picture
    14,065 on at

    It looks like you need to set the report credentials using the SetExecutionCredentials method. The CRM RS connector expects you to pass the userid and organizationid as a report credential - see https://mscrmuk.blogspot.com/2010/08/crm-40-reporting-services-connector-how.html - although written for CRM 4.0, it is still relevant

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans