Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Run the SSRS report based on specific Entity Record

Posted on by 315

Dear All,

i have implemented the SSRS report that is based on SQL query, i have deployed the same in the CRM instance(for the  custom entity report has implemented).

now when i open the record for the custom Entity and when i click on Run report button,based on the  particular opened Records value has to display in report level.

please can anyone guide me for the same with out using java script how we can do in Query level.

Regards,

Krishna.

*This post is locked for comments

  • Suggested answer
    Krishna potdar Profile Picture
    Krishna potdar 315 on at
    RE: Run the SSRS report based on specific Entity Record

    HI Vijay,

    Thanks for the update!

    If its working fine,please mark as answered

    Regards,

    Krishna.

  • RE: Run the SSRS report based on specific Entity Record

    Krishna - thanks for detailed code. I will check and get back to you.

  • Suggested answer
    Krishna potdar Profile Picture
    Krishna potdar 315 on at
    RE: Run the SSRS report based on specific Entity Record

    HI Vijay,

    please go through the below mentioned Script once.

    function functionname()

    {

    var entityGuid = Xrm.Page.data.entity.getId();

    var entityType = "1088"; //Replace

    var Optionsetvalue=get the option set value here ;

    write --switch case for that

    switch(Optionsetvalue)

    {

    case 1: //report for option set value 1

      var rdlName = "Order.rdl"; //Replace

      var reportGuid = "8500df62-a624-e411-8882-6c3be5a8ea94"; //Replace

      var url = Xrm.Page.context.getClientUrl() + "/crmreports/viewer/viewer.aspx?action=run&context=records&helpID=" + rdlName + "&id={" + reportGuid + "}&records=" + entityGuid + "&recordstype=" + entityType;

      window.open(url, null, 800, 600, true, false, null);

    break;

    case 2: //report for option set value 2

      var rdlName = "Order.rdl"; //Replace

      var reportGuid = "8500df62-a624-e411-8882-6c3be5a8ea94"; //Replace

      var url = Xrm.Page.context.getClientUrl() + "/crmreports/viewer/viewer.aspx?action=run&context=records&helpID=" + rdlName + "&id={" + reportGuid + "}&records=" + entityGuid + "&recordstype=" + entityType;

      window.open(url, null, 800, 600, true, false, null);

    break;

    case 3: //report for option set value 3

      var rdlName = "Order.rdl"; //Replace

      var reportGuid = "8500df62-a624-e411-8882-6c3be5a8ea94"; //Replace

      var url = Xrm.Page.context.getClientUrl() + "/crmreports/viewer/viewer.aspx?action=run&context=records&helpID=" + rdlName + "&id={" + reportGuid + "}&records=" + entityGuid + "&recordstype=" + entityType;

      window.open(url, null, 800, 600, true, false, null);

    break;

    }

    }

    Regards,

    Krishana.

  • Suggested answer
    Krishna potdar Profile Picture
    Krishna potdar 315 on at
    RE: Run the SSRS report based on specific Entity Record

    Hi Vijay,

    Good Morning!

    For a moment suppose we will think we have an option set which has 5 different values and we have 5 ssrs reports for each option set value we have to run different different report,  in this scenario we will use Ribbon button, the option set value which we have choosen in product for that record only the specific report will open ,

    Write a java script for the ribbon button

    function functionname()

    {

    var entityGuid = Xrm.Page.data.entity.getId();

    var entityType = "1088"; //Replace

    var Optionsetvalue=get the option set value here ;

    write --switch case for that

    switch(Optionsetvalue)

    {

    case 1: //report for option set value 1

    var rdlName = "Order.rdl"; //Replace

       var reportGuid = "8500df62-a624-e411-8882-6c3be5a8ea94"; //Replace

       var entityGuid = Xrm.Page.data.entity.getId();  

       var url = Xrm.Page.context.getClientUrl() + "/crmreports/viewer/viewer.aspx?action=run&context=records&helpID=" + rdlName + "&id={" + reportGuid + "}&records=" + entityGuid + "&recordstype=" + entityType;

       window.open(url, null, 800, 600, true, false, null);

    break;

    case 2: //report for option set value 2

     var entityGuid = Xrm.Page.data.entity.getId();  

       var url = Xrm.Page.context.getClientUrl() + "/crmreports/viewer/viewer.aspx?action=run&context=records&helpID=" + rdlName + "&id={" + reportGuid + "}&records=" + entityGuid + "&recordstype=" + entityType;

       window.open(url, null, 800, 600, true, false, null);

    break;

    case 3: //report for option set value 3

     var entityGuid = Xrm.Page.data.entity.getId();  

       var url = Xrm.Page.context.getClientUrl() + "/crmreports/viewer/viewer.aspx?action=run&context=records&helpID=" + rdlName + "&id={" + reportGuid + "}&records=" + entityGuid + "&recordstype=" + entityType;

       window.open(url, null, 800, 600, true, false, null);

    break;

    }

    }

    please go through this link for the refrence

    community.dynamics.com/.../running-a-report-from-a-ribbon-button

    Regards,

    Krishna

  • RE: Run the SSRS report based on specific Entity Record

    Krishna - it is of Quote Product. Okay. You can even assume that I have OptionSet value on Quote entity. I need to call specific report on current record based on the OptionSet value selected.

  • Verified answer
    Krishna potdar Profile Picture
    Krishna potdar 315 on at
    RE: Run the SSRS report based on specific Entity Record

    Hi Ramanathan,

    Thanks for the Suggestion!

    The Question which i was posted above we have achieved through the FETCH XML.

    Regards,

    Krishna.

  • Suggested answer
    ram r Profile Picture
    ram r on at
    RE: Run the SSRS report based on specific Entity Record

    Use Explicit pre-filtering.

    For example if you are doing an union on account, create an hidden parameter called CRM_FilteredAccount and use it in query

    DECLARE @SQL nvarchar(4000)

    SET @SQL = 'SELECT <column1>, <column2>, <columnN>

    FROM ('+@CRM_FilteredAccount+') AS FA where address1_stateorprovince = ''FL''

    UNION

    SELECT <column1>, <column2>, <columnN>

    FROM ('+@CRM_FilteredAccount+') as CA where address1_stateorprovince  = ''CA'' '

    EXEC (@SQL)

    Refer:

    technet.microsoft.com/.../dn531099.aspx

  • Krishna potdar Profile Picture
    Krishna potdar 315 on at
    RE: Run the SSRS report based on specific Entity Record

    Hi Vijay,

    May i know the Products are option set values or it's a kind of record which consist of all records?

    Regards,

    krishna

  • RE: Run the SSRS report based on specific Entity Record

    Krishna, Thanks for your prompt response. My need is to generate SSRS report (something like run report on current record) on Quote Entity. I have different formats of Quote ssrs reports. Based on the product selected, the corresponding formatted ssrs report needs to be called.

  • Krishna potdar Profile Picture
    Krishna potdar 315 on at
    RE: Run the SSRS report based on specific Entity Record

    Hi Sandeep,

    Thanks for the suggestion!

    i have implemented the report using the Fetch XML and its working fine.

    Regards,

    Krishna.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans