D365 – Shifting from Dynamics Workflow to Power Automate flow

December 11, 2019 Leave a comment

First things first, Microsoft Flow is now Power Automate.

If you are either a dynamics developer or administrator, off late you might have noticed a flashing banner while creating new Process from Dynamics instance.

Flow_Scope_4

From the banner, its clear that Microsoft recommends ‘Power automate flows’ over conventional ‘Process’.

In this article, I am going to cover basics of following items, which helps you in decision making to some extent.

Lets get in to the details.

CDS connector vs Dynamics connector:

When you are creating a flow, you need to choose b/w CDS and Dynamics connector.

The key differentiation when switching from Dynamics ‘Process’ to ‘Flow’ is,

  • With CDS connector you can set ‘Scope’ and ‘Filter Attributes’ but not with Dynamics connector.

Lets understand this with an example.

Create a flow with CDS connector:

  • Connect to your Power automate portal
  • Click on ‘+ Create’ tab and choose ‘Automated flow’

Flow_Scope_16

  • In the new window, choose the ‘Common Data Service’ connector.

Flow_Scope_0

  • Under the ‘Triggers’, select ‘When a record is updated’ trigger.

Flow_Scope_2

  • If you notice, under ‘When a record is updated’, there are ‘Scope’ and ‘Attribute Filter’ options.
    • Scope : Scope decides the affected records up on flow execution. Get more details here.
    • Flow_Scope_1
    • Attribute Filter: If no filtering attributes are set flow will execute on every field updates. Add attribute filters to minimize flow execution, only on specified field updates.
    • Flow_Scope_3
  • Now add an action from the ‘Actions’ list. I’ve added a ‘Create a new record’ action.

Flow_Scope_17

Create a flow with Dynamics 365 connector:

  • Connect to your Power automate portal
  • Click on ‘+ Create’ tab and choose ‘Automated flow’
  • In the new window, choose the ‘Dynamics 365’ connector.

Flow_Scope_13

  • Under the ‘Triggers’, select ‘When a record is updated’ trigger.

Flow_Scope_14

  • This time, under ‘When a record is updated’ there are NO ‘Scope’ and ‘Attribute Filter’ options.

Flow_Scope_15

  • Which means, the flow will trigger on all field updates and there is no provision of ‘Attribute Filter’ in Dynamics 365 Connector.

Automated flow vs Instant flow (i.e., On-demand process):

One of the common questions from Admins is, how can they create an ‘On-demand’ power automate flow similar to conventional ‘On-demand’ workflow. The answer is Instant flow.

Lets see how to create a simple on-demand flow and run.

Create an Instant Flow:

  • Connect to your Power automate portal
  • Click on ‘+ Create’ tab and choose ‘Instant flow’
    • Note: You can also create ‘Instant flow’ from Dynamics application.
    • Go to the entity, from ‘Flow’ menu, click on ‘Create a flow’.

Flow_Scope_18

  • In the new window, choose the ‘Common Data Service’ connector.
  • Under the ‘Triggers’, select ‘When a record is selected’ trigger.
  • Select the ‘Environment’ and ‘Entity Name’
    • Environment: If you want your flow to always trigger based on an event in a specific environment, select that environment or Choose (Default), which will always use the database within the environment in which Power Automate runs.
  • Now add an action from the ‘Actions’ list. I’ve added a ‘Create a new record’ action.

Flow_Scope_8

  • In above screen, I am setting ‘Transaction Audit’ entities ‘Name’ field with concatenating ‘Transactions’ entities ‘Name’ and current date (i.e., utcNow()).
    • Use ‘Dynamic content’ window, to refer the values from Previous step.

Trigger Instant Flow:

  • Connect to Dynamics instance and open the record for which you have flow registered. In my case, my flow registered on ‘Transaction’ Entity.
  • From the ‘Flow’ menu, select your flow.

Flow_Scope_5.PNG

  • Click on ‘Run flow’

Flow_Scope_7

  • Make sure you got the success screen as below.

Flow_Scope_9

  • Now check whether the Action executed. In my example, I am creating a child record (i.e., Transaction Audit)

Flow_Scope_10

Formatting Dates:

If you would have noticed the previous screen, the ‘Name’ field of the ‘Transaction Audit’ was set to UTC date format.

To format the date to your choice, use formatDateTime function in your flow’s ‘Expression’.

Flow_Scope_11

Save and run the flow, you should see the formatted date as below.

Flow_Scope_12

Notes:

  • One more edge CDS connector over Dynamics connector is in terms of execution speed. More details

🙂

 

 

 

 

 

 

 

 

Obsolete Secure Communications Protocol Supported – InfoSec – Fix

December 9, 2019 Leave a comment

Last week our web application (i.e., ADX portal website) underwent Penetration testing (Also called ‘Ethical hacking’) and we got following recommendation:

Disable all affected protocols identified above. If possible, implement TLSv1.3, or TLSv1.2 otherwise.

Reason:

  • In our application’s web server (IIS), TLSv1.0 and TLSv1.1 communication protocols were enabled.
  • TLSv1.0 and TLSv1.1 were deprecated in major browsers as of Q1 2019 and will be disabled completely in early 2020.

Fix:

  • We’ve used IIS Crypto tool to disable TLSv1.0 and TLSv1.1 protocols.
  • IIS Crypto is a free tool that gives administrators the ability to enable or disable protocols, ciphers, hashes and key exchange algorithms on Windows Servers.
  • Download the IIS Crypto GUI tool in your windows server where your application is hosted.

IIS Crypto_1

  • Open the tool and un-check TLSv1.0 and TLSv1.1 options.

IIS Crypto

  • You must restart the server for changes to take effect.

🙂

 

Categories: ADX, Misc Tags: , ,

Dynamics workflow – Unable to set Email ‘Regarding’ field

December 3, 2019 Leave a comment

Other day, while working on a straight forward ‘Send Email’ using a ‘Workflow’, I could not set the ‘Regarding’ field on ‘Email’ form.

Scenario:

  • Create a new custom entity ‘Transaction’.
  • Send an Email when a new ‘Transaction’ record gets created.

So, I created a new workflow on ‘Transaction’ entity and added ‘Send Email’ step.

SendMail_0.PNG

On the ‘Email’ configuration screen, all I could see was a blank ‘Look for:’ field.

SendMail_1

Reason & Fix:

  • ‘Activities’ option was not enabled on the ‘Transaction’ entity.

SendMail_2

  • Enable ‘Activities’ and publish.
  • Go to the workflow and I got the Entity Reference in ‘Look for:’ field.

SendMail_3

Its one of those days where we struggle for trivial problems 🙂

 

Categories: CRM Tags: ,

BotDetect Captcha – 404 error – images are not loading

November 29, 2019 Leave a comment

Recently we leveraged BotDetect libraries in our Aspx MVC application to generate CAPTCHA.

After configured all the steps, CAPTCHA images were not showing up on web page.

CAPTCHA_1

Using browsers F12 option, we could notice there were 404 (i.e., Not Found) error codes.

CAPTCHA_2

Fix:

  • Issue in our case was all the BotDetect requests getting routed, which should not be.
  • Add below statement in your project’s ‘RouteConfig.cs’ file, which prevents BotDetect requests routing.

// BotDetect requests must not be routed
routes.IgnoreRoute(“{*botdetect}”,  new { botdetect = @”(.*)BotDetectCaptcha\.ashx” });

CAPTCHA_3

  • Rebuild the project and run and you should get the CAPTCHA code.

CAPTCHA_4

Refer article for the steps to configure CAPTCHA in MVC application.

🙂

Categories: ADX Tags: , ,

ADX Portal – Prevent unauthorized access of custom pages

November 26, 2019 Leave a comment

For one of our requirements, we built a custom .aspx page and placed under ‘Areas’ folder of OOB ADX website’s ‘MasterPortal’ project.

ADX_Prevent_UnAuthAccess

Issue:

  • The .aspx page was accessible without signing in to the portal by using the following URL convention
    • https://base_portal_url/Areas/folderName/Pages/filename.aspx

Fix:

  • On Page_Load of the aspx page, check whether the request is from authenticated user or not.
  • If unauthenticated request, set 401 error code (i.e., Unauthorized error) to the Response object and redirect to portals ‘SignIn’ page.
  • Below is the code snippet need to be placed in Aspx page’s ‘Page_Load’ event, which redirects unauthenticated requests to Portal’s ‘SignIn’ page.

protected void Page_Load(object sender, EventArgs e)
{
if (!Request.IsAuthenticated)
{
Response.StatusCode = 401;
Response.End();
}
}

🙂

Categories: ADX Tags: , ,

ADX/Dynamics portal – Setting up password policies

November 21, 2019 Leave a comment

If you want to imply password policy (i.e., Certain length, must have a digit, etc…) during the portal registrations, following entries need to be added to ‘Site Settings’ entity.

ADX_PasswordPolicy_1.PNG

Name Value
Authentication/UserManager/PasswordValidator/AlphanumericUserNames TRUE
Authentication/UserManager/PasswordValidator/RequireDigit TRUE
Authentication/UserManager/PasswordValidator/RequiredLength 9
Authentication/UserManager/PasswordValidator/RequireLowercase TRUE
Authentication/UserManager/PasswordValidator/RequireNonLetterOrDigit TRUE
Authentication/UserManager/PasswordValidator/RequireUppercase TRUE

If the password does not meet any of the configured setting values, you gonna get OOB validation error as follows:

ADX_PasswordPolicy

For more ‘Authentication’ related settings, refer the article

Refer this article for portals client scripting.

🙂

Canvas App using Dynamics On-premise data

November 19, 2019 Leave a comment

Last week there was a question on my blog to check for the options to build a Canvas App which consumes CRM on-premise data.

To answer this, Power Apps has connectors (CDS and Dynamics 365) to communicate with Dynamics online but there is no built-in Dynamics on-premise connector.

However there are options to connect Canvas app with Dynamics on-premise, which are listed below.

Using ‘Gateway’ to connect to SQL on-premise DB:

  • This option is about connecting to Dynamics SQL DB using on-premises data gateway.
  • The on-premises data gateway acts as a bridge to provide quick and secure data transfer between on-premises data PowerApps.
  • Refer my blog on steps to use gateway and build a Canvas App.
  • Limitation:
    • With ‘Gateway’ option we can only view Dynamics data in PowerApps.
    • There is no way to add or modify Dynamics data using the current PowerApps gateways.

Using ‘KingswaySoft’ connector:

  • KingswaySoft SSIS Integration Toolkit for Dynamics 365 includes components to integrate with CDS.
  • Using the ‘CDS Connection Manager’ we can easily connect and bring data into and out of CDS.
  • Once data is in CDS, we will be able to leverage this data with PowerApps.
  • Any updated data being generated with PowerApps will be reflected in CDS which can then be retrieved and synced with your Dynamics on-premise instance.

Integrate on-premise environment with the CDS:

  • Its the same approach, ‘KingswaySoft’ connector leverages but this option is manual integration.
  • Integrate the on premise environment with the CDS–in effect setting up a hybrid environment, where you have a copy of your configuration in the cloud as well as your on premise CRM, and create a bi-directional integration to synchronize data changes between the two environments.
  • Limitation:
    • There will be potential delay for record changes to synchronize between the On-premise and CDS.

Refer the article for more details.

🙂