locked
How to add custom functionality to " Run Report " button on mscrm form ? RRS feed

  • Question

  • Hi Team,

     We have a requirement to save PDf format of the selected report into respective  sharepoint document location when user click on the particular report from Run Report button on MSCRM entity form.

    Issue1: How to trigger this "creating & saving PDf format of the report out put into sarepoint location" from  Entity form ribbon mentu button "Run report" --> click on  " selected report"  button?

    2. Is there any way to triiger this functionality from Run report button on report viewer window?

     Thanks in advance for your solution approach..


    hari ________________________________________________________ If this post answers your question, please click "Mark As Answer" on the post and "Vote as Helpful"

    Monday, April 7, 2014 11:14 AM

All replies

  • function doPrint() {
    	var sFetch = '<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false"><entity name="ENTITY_NAME"><all-attributes /><filter type="and"><condition attribute="ENTITYID" operator="eq" value="' + Xrm.Page.data.entity.getId() + '" /></filter></entity></fetch>';
    	var sUrl = baseReportServerUrl + "?" + reportPath_FOR_REPORT + "&rs:Command=Render&rs:Parameters=false&rs:Format=pdf&rs:ClearSession=true&REPORTPARAMETERNAME=" + encodeURI(sFetch);
    
    	var winWidth = Math.floor((window.screen.availWidth) / 2);
    	var winHeight = Math.floor((window.screen.availHeight) / 3);
    	var winLeft = Math.floor((window.screen.availWidth - winWidth) / 3);
    	var winTop = Math.floor((window.screen.availHeight - winHeight) / 4);
    
    	var sFeatures = "toolbar=no,menubar=no";
    	sFeatures += ",width=" + winWidth.toString() + ",height=" + winHeight.toString();
    	sFeatures += ",left=" + winLeft.toString() + ",top=" + winTop.toString();
    
    	window.open(sUrl, null, sFeatures);
    }
    NOTE: this will not work in the Online version of CRM, and requires that you "Publish the report for external use"!!

    You will need a custom button pointing to the above script (containing report server, report, render as pdf, etc). You should be able to F11 and copy the URL from the report when you run it normally to get the majority of the URL syntax correct.

    If you are able to get this to work, please mark it as an answer.


    Monday, April 7, 2014 7:32 PM
  • Thank u for reply..

    But we need to usee OOB Run report Mneu button as it is and we need to add our saving pdf into sharepoint functionality in background of the OOB Action.

    Thanks in advance for response.


    hari ________________________________________________________ If this post answers your question, please click "Mark As Answer" on the post and "Vote as Helpful"

    Tuesday, April 8, 2014 5:59 AM
  • Hi Hari,

    I have an idea you can try to override functionality of OOB button and can write a sample js to update some field, and can initiate plugin/workflow to export your ssrs report as pdf and in the same plugin/workflow you can create share point record with attachment.

    Check this: http://a33ik.blogspot.jp/2012/11/general-approaches-to-generation-of.html

    HTH


    Our Website | Our Blog | Follow US | My Facebook Page | Microsoft Dynamics CRM 2011 Application Design
    Make sure to "Vote as Helpful" and "Mark As Answer",if you get answer of your question.

    Tuesday, April 8, 2014 6:46 AM
    Moderator
  • Thans for the Reply..

    We had the difficulty in the below scenario.

    Scenario1:

    1. open account record.

    2. Click on "Run report " men button and then click on one of the report showing as the menu items .then

    3. then The excepectation is Report has to open as normal OOB functionality but in back ground Only the selected report has to  to export to pDF and save to Share point.

    The difficulties is

    1. how to identify which report is clicked on Run report " menu items

    2. how to add our custom logic to this Run report button With out disturbing OOB functionality.

    Scenario2: if mutilple records selected and click on Run report button

    The difficulties is

    how to get the selected records ids, Selected report name  and writing custom logic on that Run report Button With out disturbing OOB functionality.

    Scenario3: From report section , Selected one of the report and clicked on " Run report" butoon

    The difficulties is 

    how to get the report nameand writing custom logic on that Run report Button With out disturbing OOB functionality

    Thnaks in Advance for the reply


    hari ________________________________________________________ If this post answers your question, please click "Mark As Answer" on the post and "Vote as Helpful"

    Wednesday, April 9, 2014 7:45 AM