10 Things in Microsoft Flow that isn’t in Azure Logic Apps

Reshared blog, here is the original one.

Sorry about the catchy headline.  I will start by saying I am perfectly ready to see a response post containing 20 things in Azure Logic Apps that we wish are in Microsoft Flow.  The point of this post isn’t about whether one product is better than another product, it is simply to highlight the very-intentional design differences and how as users we have access to both and should make our choice accordingly.

If a comparison must be made, then I think in reality, they are better seen as two siblings – LogicApps is the big sibling with more features, Flow piggybacks LogicApps, but itself has several unique tricks and sometimes, features do move between them.  I love both teams & products.

To best describe Flow to an Azure / Logic Apps person, Flow is Logic Apps + power-user / human workflow-focused workloads, combined with a mobile experience and better in-product integration.  As a result, it caters to a whole different set of scenarios that Logic Apps isn’t focused on.

1. Resource-Owned Flows

Continue reading “10 Things in Microsoft Flow that isn’t in Azure Logic Apps”

workflow execution from Plugin

Here is quick sample code for workflow execution from Plugin …

Execute workflow …

Continue reading “workflow execution from Plugin”

Field Service: Demo data import issues

demo data

There are so many questions and problems faced by field service developers while Demo data import for field Service. So thought of let’s make write on common issues for demo data import for field service, which I faced during my demo data import.

You can download demo data from here to import into your field service environment. Microsoft already provided a detailed document on how to import demo data to Field Service. you can find that in downloaded files.  But still, while importing this demo data I faced below issues.. Continue reading “Field Service: Demo data import issues”

Field Service: overview

field service

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.

Continue reading “Field Service: overview”

Fetch all parents who does not have child

free resorces

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

new things

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…

js call

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 !!

Refresh Sub-Grid based on field value

Sometimes we need to refresh (or load data) MSD 365 sub-grid data based on some condition. This can be done with small JS, here is the sample code, its applicable to the editable grid as well….

But make sure that

  • The grid you are configuring is not set to ‘Related Records only’
  • You are configuring same entity which you querying in the query

ed grid

Here is the code ….

function FilterSubgridBasedOnField() {
var sGrid = window.parent.document.getElementById("Your_Grid_Name");
if (sGrid == null) {
alert("Grid is null");
setTimeout(function () { FilterSubgridBasedOnField(); }, 2000);
return;
 }
var fetchXml = [ "Your Fetch XML Query" ].join("");
if (sGrid.control != null) {
sGrid.control.SetParameter("fetchXml", fetchXml);
sGrid.control.refresh();
alert("Sub-Grid has updated with new data.");
 }
else {
setTimeout(FilterSubgridBasedOnField, 500);
}
}

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”

bulk Create/Update/Delete for Dynamics 365

 Secret

Create / Update / Delete can be done with bulk operation, to avoid more DB hits and it will improve performance of the plugins and or code.

Here is reference MSDN URL http://msdn.microsoft.com/en-us/library/jj863631.aspx

Default max batch size is 1000, its applicable for all three create/update/delete.

  1. bulk Create can be done with following code snippet
CreateRequest createRequest = new CreateRequest { Target = 'your Entity Object' };

2. bulk Update can be done with following code snippet

UpdateRequest updateRequest = new UpdateRequest { Target = 'your Entity Object' };

3. bulk Delete can be done with following code snippet

DeleteRequest deleteRequest = new DeleteRequest { Target = 'your Entity Reference Object' };

Here are sample code blocks for bulk Update

 

Create multiple execute request

/// <summary>
 /// Create an ExecuteMultipleRequest object
 /// </summary>
 /// <returns></returns>
 private static ExecuteMultipleRequest CreateBulkExcuteRequest()
 {
 var multipleRequest = new ExecuteMultipleRequest()
 {
 // Assign settings that define execution behavior: continue on error, return responses.
 Settings = new ExecuteMultipleSettings()
 {
 ContinueOnError = false,
 ReturnResponses = true
 },
 // Create an empty organization request collection.
 Requests = new OrganizationRequestCollection()
 };
 return multipleRequest;
 }

Continue reading “bulk Create/Update/Delete for Dynamics 365”