Run workflow on ribbon button in Dynamics CRM



To run workflow on ribbon button. follow the below steps:

1. Activate your Workflow and get "ID" of workflow.
2. Prepare new solution with entity and related require components also.
3.Open "Ribbon workbench solution". Select the Solution created by you in which you want to create a new button.
4. Drag the button and drop as per your requirement.
5. Give specific name, create command for that button, etc.
6. Now "enable rules"  for that button. As IS CORE = 'TRUE" by default it will be false.


7.Click on "commad " and add this following as shown in below screenshot.
“/_static/_forms/form.js”
and in the Function Name field= “Mscrm.FormAction.launchOnDemandWorkflowForm“.




8.After that in ribbon workbench click on "Publish". 
Go to CRM instance and refresh the page. Open the respective entity where the Button is created.
9.Based on workflow click on button it will run like this below screenshot. 
10. We have deployed workflow in Ribbon workbench button.





SSRS REPORT FOR CRM ONLINE

Fetchxml using for SSRS REPORT for selected record, prefiltering in Dynamics CRM.


We have used Fetchxml for SSRS report in Dynamic CRM.
In the below code we have used link entity and condition to fetch another entity record details in one report.


<?xml version="1.0"?>
<fetch output-format="xml-platform" distinct="false" version="1.0" mapping="logical">
<entity name="opportunityproduct" >
<attribute name="productid"/>
<attribute name="productdescription"/>
<attribute name="priceperunit"/>
<attribute name="quantity"/>
<attribute name="extendedamount"/>
<attribute name="opportunityproductid"/>
<order attribute="productid" descending="false"/>
<link-entity name="opportunity" link-type="inner" alias="af" from="opportunityid" to="opportunityid">
<attribute name="parentaccountid"/>
</link-entity>
</entity>
</fetch>
<filter type="and">
</filter>

TO PASS PARAMETERS BASED ON SPECIFIC FIELDS

We can also created parameters in SSRS report based on id or specific field in SSRS REPORT.

<?xml version="1.0"?>
<fetch output-format="xml-platform" distinct="false" version="1.0" mapping="logical">
<entity name="opportunityproduct" >
<attribute name="productid"/>
<attribute name="productdescription"/>
<attribute name="priceperunit"/>
<attribute name="quantity"/>
<attribute name="extendedamount"/>
<attribute name="opportunityproductid"/>
<order attribute="productid" descending="false"/>
<link-entity name="opportunity" link-type="inner" alias="af" from="opportunityid" to="opportunityid">
<attribute name="parentaccountid"/>
</link-entity>
</entity>
</fetch>
<filter type="and">
<condition attribute="opportunityid" operator="eq" uiname="test" uitype="opportunity" value="@CRM_Filteredopportunityproduct"/>
</filter>



PARAMETERS:-

Another dataset name is the "CRM_Filteredopportunityproduct". To get link the above parameters in SSRS REPORT.



<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
  <entity name="opportunityproduct">
    <attribute name="opportunityid" />
  </entity>
</fetch>


ON SELECTED RECORDS:-

We can also display SSRS REPORTS on selected record in Dynamic CRM by using  "enableprefiltering="1" "OR "enableprefiltering="true"" OR "enableprefiltering="false"" and
"enableprefiltering="0"".



<?xml version="1.0"?>
<fetch output-format="xml-platform" distinct="false" version="1.0" mapping="logical">
<entity name="opportunityproduct" enableprefiltering="1" prefilterparametername="CRM_Filteredopportunityproduct">
<attribute name="productid"/>
<order attribute="productid" descending="false"/>
<link-entity name="opportunity" link-type="inner" alias="af" from="opportunityid" to="opportunityid">
<attribute name="parentaccountid"/>
</link-entity>
</entity>
</fetch>
</filter>








SSRS REPORT ERROR IN VISUAL STUDIO 2015


Error occurred while preview in visual studio 2015 SSRS Report for Dynamic CRM using fetchxml






We faced this error at report preview in VS 2015. We solved this issue by installing the application called "FiddlerSetup.exe".


 Click on the Tool->Options->Https.

Click on "Protocols" <client>;ssl3;tls1.0 will be displayed. Here now you click on "<client>;ssl3;tls1.0" and add extend like this "<client>;ssl3;tls1.0;tls1.2".
click on "OK".


Note:Allow the credentials to pass click on "YES".


To add Dynamic Charts in CRM Portals

View charts CRM PORTALS

We have approached to get dynamic Charts In CRM Portals through this code. Get The Chart Id and add below code snippet in Portals scripts(To display chart in specific page). 
Refresh the portal page.

Our Code snippet is:

{% chart id:"EE3C733D-5693-DE11-97D4-00155DA3B01E" viewid:"00000000-0000-0000-00AA-000010001006" %}

Add the Dynamic values inside option set through java script in Dynamics 365.

ADD DYNAMIC VALUES IN OPTIONSET

We have a scenario Contact Entity, Test is custom entity. Contact entity has fields like full name and Test entity like contact(option set) is null. We should fill the full name values inside the option set in custom entity. We have approached with ODATA service shown below.

Get contact "fullname" into test entity contact option set field through odata services.

function getcontact()
{
debugger;
//get the contact entity data
var oDataUri = Xrm.Page.context.getClientUrl() +"/xrmservices/2011/OrganizationData.svc/ContactSet?$select=YomiFullName";
      alert(oDataUri);
$.ajax({
type: "GET",
            async: false,
contentType: "application/json; charset=utf-8",
            datatype: "json",
            url: oDataUri,
            beforeSend: function (XMLHttpRequest) {XMLHttpRequest.setRequestHeader("Accept", "application/json");},
            success: function (data, textStatus, XmlHttpRequest) {
alert(data.d.results.length);
//data.d.results.length counts the contact entity total records.
            var i;
for(i=0; i<data.d.results.length; i++)
{
var child= data.d.results[i].YomiFullName;
    Xrm.Page.getControl("new_contact").addOption({value:i , text : child});
            }
           },
            error: function (XMLHttpRequest, textStatus, errorThrown) { alert("error call"); }
        });
}



By using ODATA Services in java script we can achieve only 50 records. if you want to retrieve more than 50 records through ODATA Services use below code.

relatedContact = [];

 if (data && data.d != null && data.d.results != null) {
                Accept(data.d.results);
                fetch(data.d);
            }


function Accept(records) {
    for (var i = 0; i < records.length; i++) {
        relatedContact.push(records[i]);
    }
}

function fetch(records) {
    if (records._next != null) {
        var url = records._next;
        GetRecords(url);
    }
}