Sometime we need to send parameter dynamically to SSRS report, to achieve it below JS function will help … here key thing is “&p:”, whatever next to this one will be considered as parameter, e.g. “&p:parameterName=parameterValue”. You can pass more than one parameters too.
Continue reading “Pass parameter to RDL”Category: CRM 2016
workflow execution from Plugin
Here is quick sample code for workflow execution from Plugin …
Execute workflow …
Field Service: Sample data installation
While studying Field Service, Field Service installation is not enough, we need to install sample data or seed data in the environment, so we will get clear idea of how its looks like and we can play with that sample data just like real one.
As well, it can be used for demo purpose.
So here are the steps to install sample data for Field Service… Continue reading “Field Service: Sample data installation”
Field Service: overview
Field Service Overview
Field Service capabilities extend Dynamics 365 to provide a complete Field Service management solution. It helps to….
- Optimize your service schedule with efficient routing, resource skill matching, and reduced travel time.
- Increase first time fix rates and on-time delivery performance.
- Enhance real-time communication and collaboration between customer service, dispatch, field agents, and customers.
Field Service: installation
Filed Service is one of the great feature available with MSD 365, here is the overview of it. Microsoft has developed managed solution for it we can install that in our environment, its available in Dynamics Marketplace.
Here are steps to install that in the environment…. Continue reading “Field Service: installation”
Open create ‘Form’ from sub-grid directly by avoiding associated records between entities
In MSD 365, when we add sub-grid on form by creating relation between two entities, it will gives Create (+) button and associate view button. When we click on Create (+) button, dynamics shows already created associations between these two entities, ref below screen shots…
Some time we don’t require this associated records and always want to create new record by avoiding all those clicks. We can achieve it by making relation mandetory, just as shown in below image.
…and you are done, now go back to the subgrid and click on the ‘Create’ (+) button, it will launch new create window and won’t ask to select existing association.
Thanks.
Fetch all parents who does not have child
In one of scenario I was looking for all available Assets only, means show only those assets who are available for particular data range. Just like get all parents who does not have any child.
So, after some googling i found below way, but i was showing all booked and non booked assets for given date range.
Out of the box it wont give NOT-IN result, for it we need to change ‘Inner’ to ‘Outer’
<link-entity name="bookableresourcebooking" from="resource" to="bookableresourceid" link-type="outer" alias="aj">
Here is the complete sample fetch XML…..
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="true">
<entity name="bookableresource">
<attribute name="name" />
<attribute name="bookableresourceid" />
<order attribute="name" descending="false" />
<filter type="and">
<condition attribute="statecode" operator="eq" value="0" />
</filter>
<link-entity name="bookableresourcecategoryassn" from="resource" to="bookableresourceid" link-type="inner" alias="ai">
<filter type="and">
<condition attribute="resourcecategory" operator="eq" uiname="Backhoe" uitype="bookableresourcecategory" value="{798E6C02-3BBE-E711-8123-E0071B686A81}" />
</filter>
</link-entity>
<link-entity name="bookableresourcebooking" from="resource" to="bookableresourceid" link-type="outer" alias="aj">
<filter type="and">
<condition attribute="starttime" operator="on-or-after" value="2018-03-01" />
<condition attribute="endtime" operator="on-or-before" value="2018-03-31" />
<condition attribute="bookingstatus" operator="not-in">
<value uiname="Hard" uitype="bookingstatus">{6ABF1A73-DFB9-E711-8129-E0071B67C991}</value>
<value uiname="Soft" uitype="bookingstatus">{6BBF1A73-DFB9-E711-8129-E0071B67C991}</value>
</condition>
</filter>
</link-entity>
</entity>
</fetch>
But, it was not satisfactory one, as I was interested only for available assets. So with below little tweak its possible which include above tweak.
<condition entityname="bookableresourcebooking" attribute="resource" operator="null" />
and here is complete sample for it ….
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="true"> <entity name="bookableresource"> <attribute name="name" /> <attribute name="bookableresourceid" /> <order attribute="name" descending="false" /> <filter type="and"> <condition attribute="statecode" operator="eq" value="0" /> <condition entityname="bookableresourcebooking" attribute="resource" operator="null" /> </filter> <link-entity name="bookableresourcecategoryassn" from="resource" to="bookableresourceid" link-type="inner" alias="ai"> <filter type="and"> <condition attribute="resourcecategory" operator="eq" uiname="Backhoe" uitype="bookableresourcecategory" value="{798E6C02-3BBE-E711-8123-E0071B686A81}" /> </filter> </link-entity> <link-entity name="bookableresourcebooking" from="resource" to="bookableresourceid" link-type="outer" alias="aj"> <filter type="and"> <condition attribute="starttime" operator="on-or-after" value="2018-03-01" /> <condition attribute="endtime" operator="on-or-before" value="2018-03-31" /> <condition attribute="bookingstatus" operator="not-in"> <value uiname="Hard" uitype="bookingstatus">{6ABF1A73-DFB9-E711-8129-E0071B67C991}</value> <value uiname="Soft" uitype="bookingstatus">{6BBF1A73-DFB9-E711-8129-E0071B67C991}</value> </condition> </filter> </link-entity> </entity> </fetch>
Simple one but it will save hours.
Thanks!!
Editable Grid: Make it read only
We have a out the box option to make editable grid read only on the from it self but its applicable only for the views not for the sub-grids. Thus, with small JavaScript we can make it read only based on our business requirements. Here is the sample code for it
function setFieldsDisabled(context) {
context.getFormContext().getData().getEntity().attributes.forEach(function (attr) {
attr.controls.forEach(function (c) {
if (c.getName("name") == "soft_ownercopy") {
c.setDisabled(false);
}
else {
c.setDisabled(true);
}
})
});
}
Call it on where you want to…
Thanks!!
Get data from selected rows of Sub-Grid
Here is the sample code to get desired data ( sample shows about GUIDS) from selected rows from the editable grid.
function GetSelecctedGuidsFromGrid() { //Get an array of entity references for all selected rows in the subgrid var selectedEntityReferences = []; var sGuids = ""; //get selected rows from grid var sRows = Xrm.Page.getControl("booked_asset").getGrid().getSelectedRows(); sRows.forEach(function (selectedRow, i) { selectedEntityReferences.push(selectedRow.getData().getEntity().getEntityReference()); }); //get all required data from each selected row for (let i = 0; i < selectedEntityReferences.length; i++) { if (sGuids == "") { sGuids = (selectedEntityReferences[i].id.toString()); } else { sGuids = sGuids + "," + (selectedEntityReferences[i].id.toString()); } } //clear field value Xrm.Page.getAttribute("soft_selectedassetlist").setValue(""); //set attribute value Xrm.Page.getAttribute("soft_selectedassetlist").setValue(sGuids); Xrm.Page.data.entity.save(); }
Thanks !!
Document creation in MSD 365
Many times we need to create document in MSD CRM and or MSD 365, ex. Quote. In earlier CRM version it was not available out of the box. But as part of MSD CRM 2016 and MSD 365 its has been introduced out of the box, in few clicks we cam create document or automate the process with the help of out of box workflow. Continue reading “Document creation in MSD 365”