Unified Client Interface (UCI) Archives - Microsoft Dynamics 365 Blog https://microsoftdynamics.in/category/microsoft-dynamics-365/unified-client-interface-uci/ Microsoft Dynamics CRM . Microsoft Power Platform Sat, 27 May 2023 06:57:48 +0000 en-US hourly 1 https://wordpress.org/?v=6.5.5 https://i0.wp.com/microsoftdynamics.in/wp-content/uploads/2020/04/cropped-Microsoftdynamics365-blogs.png?fit=32%2C32&ssl=1 Unified Client Interface (UCI) Archives - Microsoft Dynamics 365 Blog https://microsoftdynamics.in/category/microsoft-dynamics-365/unified-client-interface-uci/ 32 32 176351444 UCI : Disable Editable Grid for Entity list , Unable to double click lead record from entity list or getting error while opening record from Entity list https://microsoftdynamics.in/2020/09/29/disable-editable-grid-for-entity-list-unable-to-double-click-lead-record-from-entity-list-or-getting-error-while-opening-record-from-entity-list-uci/ Tue, 29 Sep 2020 17:28:25 +0000 http://microsoftdynamics.in/?p=4198 We have enabled the Editable grid for sub-grid and quite familiar how it works but using it on entity list is not so common as we have thousands of records and we don't want to mess with validation like a duplicate rule or business rule in Entity list.

But if by any chance you have enabled editable grid in Entity List it will be following up with lots of validation issues over UCI. Below are the steps to disable it. With Control option over Entity itself

The post UCI : Disable Editable Grid for Entity list , Unable to double click lead record from entity list or getting error while opening record from Entity list appeared first on Microsoft Dynamics 365 Blog.

]]>

We have enabled the Editable grid for sub-grid and quite familiar how it works but using it on entity list is not so common as we have thousands of records and we don't want to mess with validation like a duplicate rule or business rule in Entity list.

But if by any chance you have enabled editable grid in Entity List it will be following up with lots of validation issues over UCI. Below are the steps to disable it. With Control option over Entity itself

https://i0.wp.com/microsoftdynamics.in/wp-content/uploads/2020/09/ERROR-WHILE-OPRNING-LEAD-RECORD.png?fit=1744%2C830&ssl=1

We can see in the above image there is legacy data that is duplicate and was ignored and saved, but when Migrating to UCI the Entity list is having Editable control which does not allow to open record because of this duplicate rule but nor giving any exact error.

  1. we can disable Editable gird control from the entity.

  2.  We can do modification to duplicate rule as desired so we can avoid error in entity list

  3. Or we can review Business Rule as well especially the one with Entity as the scope

Hoping this was helpful. thanks

The post UCI : Disable Editable Grid for Entity list , Unable to double click lead record from entity list or getting error while opening record from Entity list appeared first on Microsoft Dynamics 365 Blog.

]]>
4198
Enable Queue or lead entity in TO or Form Field of Email of Sales up and customer service Hub – lead entity is not visible under email TO and From Field https://microsoftdynamics.in/2020/09/29/enable-queue-or-lead-entity-in-to-or-form-field-of-email-of-sales-up-and-customer-service-hub-lead-entity-is-not-visible-under-email-to-and-from-field/ Tue, 29 Sep 2020 14:41:16 +0000 http://microsoftdynamics.in/?p=4188 As we can see in the above screenshot when we open an email from Sales Hub it doesn't search for Queue record in TO or FROM fields and the same way if we open an email from Customer Service Hub it won't search  Lead record.

As we know in Legacy Web client there was no setting available to include or exclude them except Javascript so it took us some time to accept there might be some configuration or setting we might be missing. and with some research, my college provided the information providing below community query and it was helpful. thanks to Clofly Mao

https://community.dynamics.com/crm/f/microsoft-dynamics-crm-forum/361316/how-to-enable-the-email-from-field-to-include-queues-as-a-selection

So we can follow the below steps to add or remove entities from Model-Driven apps to show or hide them from Email entity but remember these are not only limited to Emails, if you remove any entity it will be removed from whole model-driven app.

Go to
https://dvmske.crm8.dynamics.com/main.aspx?forceUCI=0&pagetype=apps
and open app designer or best practice is to create a solution add your model-driven app to it and then edit the same.

The post Enable Queue or lead entity in TO or Form Field of Email of Sales up and customer service Hub – lead entity is not visible under email TO and From Field appeared first on Microsoft Dynamics 365 Blog.

]]>

At First Glance, this looks like some kind of bug that in Customer service hub To field Contain different entity from Sales Hub as in the Legacy Web Client there was no option to configure TO or FROM field Entities without JS.

But in UCI you can add or remove the entity from TO or FROM "Party field" of Email but sacrificing howl entity from the HUB.

https://i0.wp.com/microsoftdynamics.in/wp-content/uploads/2020/09/entity-missing-from-email-party-fields.png?fit=1931%2C1165&ssl=1

As we can see in the above screenshot when we open an email from Sales Hub it doesn’t search for Queue record in TO or FROM fields and the same way if we open an email from Customer Service Hub it won’t search  Lead record.

As we know in Legacy Web client there was no setting available to include or exclude them except Javascript so it took us some time to accept there might be some configuration or setting we might be missing. and with some research, my college provided the information providing below community query and it was helpful. thanks to Clofly Mao

https://community.dynamics.com/crm/f/microsoft-dynamics-crm-forum/361316/how-to-enable-the-email-from-field-to-include-queues-as-a-selection

So we can follow the below steps to add or remove entities from Model-Driven apps to show or hide them from Email entity but remember these are not only limited to Emails, if you remove any entity it will be removed from whole model-driven app.

  1. Go to
    https://dvmske.crm8.dynamics.com/main.aspx?forceUCI=0&pagetype=apps
    and open app designer or best practice is to create a solution add your model-driven app to it and then edit the same.

  2. Click on Entities which will open up a list of entities checked means added to the app

  3.  Search for the entity missing

  4. Check the entity and then scroll from Entity View to add forms or view to be available on the hub

  5. Save and Publish

Same Way we can add lead fro the Customer Service hub and now Both entities will be visible in TO fields of the email.

The post Enable Queue or lead entity in TO or Form Field of Email of Sales up and customer service Hub – lead entity is not visible under email TO and From Field appeared first on Microsoft Dynamics 365 Blog.

]]>
4188
UCI How Dynamic URL work in UCI with some additional application mode parameters https://microsoftdynamics.in/2020/09/29/uci-how-dynamic-url-work-in-uci-with-some-additional-application-mode-parameters/ Mon, 28 Sep 2020 23:49:18 +0000 http://microsoftdynamics.in/?p=4179 Explaining Unified client interface URL Parameter and how it dynamically change the value while navigating to different pages

Table of Contents:

00:00 - Introduction
00:29 - UCI Dynamics URL parameters
01:32 - Unified client Interface URL Explained
03:16 - Cmdbr or command bar
03:54 - NavBar or Navigation Bar
04:23 - Create a power automate the flow
06:39 - Get Environment URL in Power automate
08:19 - Create Dynamics Record URL in ms Flow
10:31 - Add dynamics URL in Email

The post UCI How Dynamic URL work in UCI with some additional application mode parameters appeared first on Microsoft Dynamics 365 Blog.

]]>

Explaining Unified client interface URL Parameter and how it dynamically change the value while navigating to different pages

Table of Contents:

00:00 – Introduction
00:29 – UCI Dynamics URL parameters
01:32 – Unified client Interface URL Explained
03:16 – Cmdbr or command bar
03:54 – NavBar or Navigation Bar
04:23 – Create a power automate the flow
06:39 – Get Environment URL in Power automate
08:19 – Create Dynamics Record URL in ms Flow
10:31 – Add dynamics URL in Email

One of the Interesting thing in UCI is the way URL changes while navigating between pages examples

If we navigate to Entity form PageType = Entity , ent=logicallname , ID = guid

If we Navigate to Entity List PageType =EntityList , ViewID =GUID

If we navigate to Dashboard PageType = Dashboard with ID

As per the above image, the URL contains 3 parts

  1. URL of Environment: when we talk about the dynamic Record URL it should also consider when we move from UATto production we should not change it in the Production manual it should automatically take the URL of Environment.DVMSKEUAT.CRM.Dynamics.com to DVMSKEPROD.CRM.Dynamics.com
  2. App ID: Each App has it unique Id if you want that Entity to open in a specific App we need to Define it in the URLappid = GUID
  3. CMD Bar: CRM Bar is the bar where we navigate throw cmd buttons. We can remove/add-in from window by putting cmdbar= false/true

  4. NavBar: This is the Blue bar of CRM where we navigate app and entity history, We can Remove/add in form window by setting navbar=on/off

  • PageType: it is used to define type of page , Example pagetype=dashboard , pagetype=entitylist , pagetype=entity  E.T.C

  • ENT: ent stands for Entity where we define the name of entity example account, contact, incident in our case
  • ID: this defines GUID unique id of the page type or entity we want to retrieve data for example if we  using pagetype= Dashboard it will need GUID of Dashboard

Thank you.

The post UCI How Dynamic URL work in UCI with some additional application mode parameters appeared first on Microsoft Dynamics 365 Blog.

]]>
4179
Migration to UCI : Ribbon button not visible / Hidden , Debug Entity Ribbon application command bar using command checker https://microsoftdynamics.in/2020/09/18/migration-to-uci-ribbon-button-not-visible-hidden-debug-entity-ribbon-application-command-bar-using-command-checker/ Fri, 18 Sep 2020 16:37:11 +0000 http://microsoftdynamics.in/?p=4167 There is a new command available in UCI to help us troubleshoot the ribbon, It will show Button Properties, Command Properties like Action, Enable Rule, Display rule, and the best part is we don't have to install any tool or enable anything.

We just need to add these parameters in the entity "&flags=FCB.CommandChecker=true&ribbondebug=true"

It can be an entity

https://dvmske.crm8.dynamics.com/main.aspx?appid=68968382-8ff4-ea11-a815-000d3a3dfcae&forceUCI=1&pagetype=entitylist&etn=account&viewid=00000000-0000-0000-00aa-000010001001&viewType=1039&flags=FCB.CommandChecker=true&ribbondebug=true

It can be a form

https://yourOrg.crm8.dynamics.com/main.aspx?appid=68968382-8ff4-ea11-a815-000d3a3dfcae&forceUCI=1&pagetype=entityrecord&etn=account&id=aaa19cdd-88df-e311-b8e5-6c3be5a8b200&flags=FCB.CommandChecker=true&ribbondebug=true

It can be Sub Grid 

The post Migration to UCI : Ribbon button not visible / Hidden , Debug Entity Ribbon application command bar using command checker appeared first on Microsoft Dynamics 365 Blog.

]]>
https://i0.wp.com/microsoftdynamics.in/wp-content/uploads/2020/09/debug-ribbon-button-mscrm.png?fit=2550%2C1384&ssl=1

While the transition to new UCI, We might have seen a few ribbons (OOB or custom) would not be visible in UCI and we checked every enable disable rule nothing looks wrong, and in legacy, its working fine, In this post we will check how we can debug each button i.e which display , enable rule or action failing on a button

There is a new command available in UCI to help us troubleshoot the ribbon, It will show Button Properties, Command Properties like Action, Enable Rule, Display rule, and the best part is we don’t have to install any tool or enable anything.

We just need to add these parameters in the entity “&flags=FCB.CommandChecker=true&ribbondebug=true”

  • It can be an entity

    https://dvmske.crm8.dynamics.com/main.aspx?appid=68968382-8ff4-ea11-a815-000d3a3dfcae&forceUCI=1&pagetype=entitylist&etn=account&viewid=00000000-0000-0000-00aa-000010001001&viewType=1039&flags=FCB.CommandChecker=true&ribbondebug=true
    
    

  • It can be a form

    https://yourOrg.crm8.dynamics.com/main.aspx?appid=68968382-8ff4-ea11-a815-000d3a3dfcae&forceUCI=1&pagetype=entityrecord&etn=account&id=aaa19cdd-88df-e311-b8e5-6c3be5a8b200&flags=FCB.CommandChecker=true&ribbondebug=true
    
    

  • It can be Sub Grid

 

When we click on Command Checker

  • It Gives us all Buttons available in Command Bar with property Hidden with name

  • Clicking on Button, it will elaborate more on Button Property and  Command Property, Example in below we are checking why Activate button is hidden, and in Command Properties, we can see display rule resulted in false and we can check which condition failed

This is much helpful in this time where most of us are transitioning from legacy to UCI and get many buttons which are hard to identify why they are not visible in UCI but same in visible in legacy WebClient. Thanks

The post Migration to UCI : Ribbon button not visible / Hidden , Debug Entity Ribbon application command bar using command checker appeared first on Microsoft Dynamics 365 Blog.

]]>
4167
Get AppID of Dynamics 365 Crm App in power Automate – UCI https://microsoftdynamics.in/2020/09/12/get-appid-of-dynamics-365-crm-app-in-power-automate-uci/ Sat, 12 Sep 2020 14:40:51 +0000 http://microsoftdynamics.in/?p=4135 In Our last post we dynamically created Record URL in power automate but skipped Appid part ,

Click here for: http://microsoftdynamics.in/2020/09/12/uci-get-entity-record-url-or-generate-dynamic-record-url-of-a-record-in-power-automate-using-cds-connector-and-variable/

Below are the steps

Create an entity "Organization Config" and create 2 fields,
Sales hub App ID and Service Hub App ID

Add Entity in Model-Driven App and side map where ever we want to keep it

Now We will open our Power automate flow we created in the last post, Add an action "List Records"

As we are using List Records which will give multiple results, we can use Odata filter or Fetch XMl to fetch the records

This action gives Collection as output, we will use the below expression to get value from 1st record.

body('get_org_config_list')?['value']?[0]?.dvm_salesappid

Now we will use compose action output in our variable

The post Get AppID of Dynamics 365 Crm App in power Automate – UCI appeared first on Microsoft Dynamics 365 Blog.

]]>

Each Model Driven App has a Unique ID and OOB there is no action in power automate to get ID of a particular required APP, Below are the step we can use to fulfill the requirement to get AppID in Power automate

In Our last post we dynamically created Record URL in power automate but skipped Appid part ,

Click here for: http://microsoftdynamics.in/2020/09/12/uci-get-entity-record-url-or-generate-dynamic-record-url-of-a-record-in-power-automate-using-cds-connector-and-variable/

Below are the steps

  • Create an entity “Organization Config” and create 2 fields,
    Sales hub App ID and Service Hub App ID

  • Add Entity in Model-Driven App and side map where ever we want to keep it

  • Now We will open our Power automate flow we created in the last post, Add an action “List Records”

  • As we are using List Records which will give multiple results, we can use Odata filter or Fetch XMl to fetch the records

  • This action gives Collection as output, we will use the below expression to get value from 1st record.

    body('get_org_config_list')?['value']?[0]?.dvm_salesappid

  • Now we will use compose action output in our variable

The post Get AppID of Dynamics 365 Crm App in power Automate – UCI appeared first on Microsoft Dynamics 365 Blog.

]]>
4135
UCI : Get Entity Record URL or Generate Dynamic Record URL of a Record in Power automate using CDs connector and Variable https://microsoftdynamics.in/2020/09/12/uci-get-entity-record-url-or-generate-dynamic-record-url-of-a-record-in-power-automate-using-cds-connector-and-variable/ Sat, 12 Sep 2020 12:14:06 +0000 http://microsoftdynamics.in/?p=4120 In Point 1 we got the environment url and from point 2 we know how to get AppId as well, but here we are not using appid and if we don't use it that doesn't it will automatically open it available app as per permission.

We created an Trigger as update of case
Using compose output and get record we got the Odata URL as well
Now we will initialize Variable just to get the final output of the dynamic record URL, we can do this directly in email as well.

 Now we will use Hyperlink or ancher html tag to use Record url in Email

In Output we can see our URL which can be with or withour CMDBAR and NAVBAR

The post UCI : Get Entity Record URL or Generate Dynamic Record URL of a Record in Power automate using CDs connector and Variable appeared first on Microsoft Dynamics 365 Blog.

]]>

We would be using power automated flow to generate a dynamic record URL, we will also check how to get the Current Record URL in power to automate

The Scenario we had is when a case is resolved, send an email to the manager of the record that the Case is resolved including Record URL.

As per the above image, the URL contains 3 parts

  1. URL of Environment: when we talk about the dynamic Record URL it should also consider when we move from UATto production we should not change it in the Production manual it should automatically take the URL of Environment.DVMSKEUAT.CRM.Dynamics.com to DVMSKEPROD.CRM.Dynamics.com
  2. App ID: Each App has it unique Id if you want that Entity to open in a specific App we need to Define it in the URLappid = GUID 
  3. CMD Bar: CRM Bar is the bar where we navigate throw cmd buttons. We can remove/add-in from window by putting cmdbar= false/true

  4. NavBar: This is the Blue bar of CRM where we navigate app and entity history, We can Remove/add in form window by setting navbar=on/off

  5. PageType: it is used to define type of page , Example pagetype=dashboard , pagetype=entitylist , pagetype=entity  E.T.C

  6. ENT: ent stands for Entity where we define the name of entity example account, contact, incident in our case
  7. ID: this defines GUID unique id of the page type or entity we want to retrieve data for example if we  using pagetype= Dashboard it will need GUID of Dahsboard

Check 1: Get Environment in Power automate flow

  • As per the Scenario, we added trigger as an update of the case with a filter as status should be equal to 5 (problem resolved)

  • Now ideally we should get Environment URL in the Dynamic field OdataID as below but that will not come up when the trigger happens from CDS
  • So we will use Action to Get Case using Trigger ID, We know its repeated step but this is needed to get Environment URL, and we can limit attribute retrieving. We are using Compose action to verify our output

  • Here we get the full Odatat URL, not just the Environment URL, so we will be using an Expression uriHosts(outputs(‘URL’)
  • Compose action: uriHosts(outputs(‘URL’) , Where outputs is output of compose and (‘url’) action name refer screenshot
  • Other Action: uriHost(body(‘ActionName’)?[‘@odata.id’]) 

Check 2: Get Appid in power automate

AppId can no be retrieved directly in Power automate.

  1. we use a configuration ” organization config”  where we store multiple appid example sales hub , customer hub etc
  2. We will use get record action to retrieve the required appid.

Check 2: Generate dynamics record URl in power automate and use in Email

In Point 1 we got the environment url and from point 2 we know how to get AppId as well, but here we are not using appid and if we don’t use it that doesn’t it will automatically open it available app as per permission.

  1. We created an Trigger as update of case
  2. Using compose output and get record we got the Odata URL as well
  3. Now we will initialize Variable just to get the final output of the dynamic record URL, we can do this directly in email as well.

  4.  Now we will use Hyperlink or ancher html tag to use Record url in Email

In Output we can see our URL which can be with or withour CMDBAR and NAVBAR

The post UCI : Get Entity Record URL or Generate Dynamic Record URL of a Record in Power automate using CDs connector and Variable appeared first on Microsoft Dynamics 365 Blog.

]]>
4120
Call Power Automate Flow from JavaScript from CRM || Execute Power Automate Flow from JavaScript and Get Response back in CRM Form, On-demand Power Automate flow from button https://microsoftdynamics.in/2020/08/23/execute-power-automate-flow-from-javascript-and-get-response-back-in-crm-form-on-demand-power-automate-flow-from-button/ Sun, 23 Aug 2020 14:53:28 +0000 http://microsoftdynamics.in/?p=4095 Call Power Automate Flow from JavaScript from CRM

1. "Execute Flow button" is Clicked from CRM
2. JS will execute Power Automate Flow using XMLHttpRequest
3.. Power Automate is Configured to send Response with Status 200 if condition fail or successful.
4. Js receives the Response and shows message as alert.

and all these activities will happen real-time

The post Call Power Automate Flow from JavaScript from CRM || Execute Power Automate Flow from JavaScript and Get Response back in CRM Form, On-demand Power Automate flow from button appeared first on Microsoft Dynamics 365 Blog.

]]>

Scenario is

1. "Execute Flow button" is Clicked from CRM
2. JS will execute Power Automate Flow using XMLHttpRequest
3.. Power Automate is Configured to send Response with Status 200 if condition fail or successful.
4. Js receives the Response and shows message as alert.

and all these activities will happen realtime

https://i0.wp.com/microsoftdynamics.in/wp-content/uploads/2020/08/ondemand-PowerAutomate-flow-using-javascript-ribboon-button-dvmske.png?fit=1195%2C802&ssl=1

The post is Divided into 2 Parts

  1. Executing PowerAutomate Flow from Button using javascript
  2. Configuring response action in Power automate and Capturing response message in CRM using javascript

Step1 : Executing PowerAutomate Flow from Button using javascript

We will action “When an Http Request is received ” and follow below steps

  1. Create Power automate Flow to receive HTTPS Request from Javascript and send Email
  2. Register Javascript
  3. Creating a Ribbon Button on Contact Entity and add javascript action to the button Command and pass PrimaryControl

As in our previous post we already mentions steps to register and use it in Javascript

Click Here : http://microsoftdynamics.in/2020/07/11/execute-microsoft-power-automate-from-ribbon-using-javascript-on-demand-power-automate-flow-using-javascript-in-uci-replace-ribbonaction-js/

Below code open request to execute power automate flow, Next step is to see how we can get Response message in JS

function readXML(executionContext) {   
var formContext = executionContext.getFormContext();
    var flowUrl = "Http Post URL";
    var input = JSON.stringify({
        "contactid": formContext .data.entity.getId().replace("{", "").replace("}", "")
    });
    var req = new XMLHttpRequest();
    req.open("POST", flowUrl, true);
    req.setRequestHeader('Content-Type', 'application/json');
    req.send(input);
}

Step2 : Add response Action in Power Automate Flow

In Step1, we had executed XMLHttpRequest and have not written code to get a response in JS, In this step we will add custom response message which we will get in Javascript .

  1. Adding action “when a HTTP request is received”, setup payload
  2. Adding Condition “1 = 1”
  3. Adding Response action with Status = 200 and Body with Message “Yes Condition”

Step3 : Get Response in Javascript

We have requested XMLHttpRequest to Execute Flow, Adding custom response msg in Power Automate,

Now we will use blow code to get response with status 200 in CRM

function readXML(executionContext) {   
var formContext = executionContext.getFormContext();
    var flowUrl = "Http Post URL";
    var input = JSON.stringify({
        "contactid": formContext .data.entity.getId().replace("{", "").replace("}", "")
    });
    var req = new XMLHttpRequest();
    req.open("POST", flowUrl, true);
    req.setRequestHeader('Content-Type', 'application/json');

////Response
req.onreadystatechange = function () {
        if (this.readyState === 4) { 
            req.onreadystatechange = null;
            if (this.status === 200) {
                var result = this.response; 
                alert("" + result); 
            }
            else if(this.status === 400){
                alert(this.statusText);
  var result = this.response; 
                alert("Error" + result);
            }
        }
    };  

////End
    req.send(input);
}

We can write the code to get request and get response Asynchronous or Synchronous Thanks

The post Call Power Automate Flow from JavaScript from CRM || Execute Power Automate Flow from JavaScript and Get Response back in CRM Form, On-demand Power Automate flow from button appeared first on Microsoft Dynamics 365 Blog.

]]>
4095
Error : getFormContext is not a function in UCI , Ribbon Button https://microsoftdynamics.in/2020/08/22/error-getformcontext-is-not-a-function-in-uci-ribbon-button/ Sat, 22 Aug 2020 13:26:24 +0000 http://microsoftdynamics.in/?p=4089 The post Error : getFormContext is not a function in UCI , Ribbon Button appeared first on Microsoft Dynamics 365 Blog.

]]>

When passing primaryControl in Ribbon WorkBench we use it as executionContext and then get FormContext out of it.

But when same thing is done on UCI we get the Error getFormContext is not a function

We got this error in UCI and not in Legacy WebClient,

  1. We were Passing CRM Parameter PrimaryControl to Button in Ribbon workbench

  2. In JS we were getting FormContext from primaryControl(Executioncontext) which was working fine in the Legacy app

    function readXML(primaryControl) {   
    var formContext  = null;
     if (primaryControl!== null) { 
                formContext = primaryControl.getFormContext(); 
             }
        }
    }
  3. But when same is called in UCI we get ” ” Script Error, Because here we need to treat primary control as formContext

So final change needed in Code is as below

function readXML(primaryControl) {   
var formContext  = null;
 if (primaryControl!== null) {
         if (typeof primaryControl.getAttribute === 'function') {
             formContext = primaryControl; //called from the ribbon.
         } else if (typeof primaryControl.getFormContext === 'function' 
                 && typeof(primaryControl.getFormContext()).getAttribute === 'function') {
            formContext = primaryControl.getFormContext(); // most likely called from the form via a handler
         }
    }
}

The post Error : getFormContext is not a function in UCI , Ribbon Button appeared first on Microsoft Dynamics 365 Blog.

]]>
4089
Migration from Legacy WebClient to UCI – Deprecated Javascript (Client Api) Collection Book , Replace Deprecated Client API To New and latest Client Api’s https://microsoftdynamics.in/2020/08/22/migration-from-legacy-webclient-to-uci-deprecated-javascript-client-api-collection-book-replace-deprecated-client-api-to-new-and-latest-client-apis/ Sat, 22 Aug 2020 12:05:40 +0000 http://microsoftdynamics.in/?p=4081 The post Migration from Legacy WebClient to UCI – Deprecated Javascript (Client Api) Collection Book , Replace Deprecated Client API To New and latest Client Api’s appeared first on Microsoft Dynamics 365 Blog.

]]>

Most of us are already using updated client API and replacing example like xrm.page to FormContext, Below is

1. How to replace Deprecated Client API Javascript with New

2. Full Deprecated to New client API Table

There are some big changes in Client API and most of them are as below

  • Execution Context: Context of any item on the form (Xrm.Page)
  • Global Context: utility to retrieve org Information example, userID e.t.c  (Xrm.utility)
  • Deprecated Client Apis and Intrrotucing some new

We will Divide the post in 2 parts

  1. Replace Deprecated Client API To New and latest Client Api’s
  2. Full Deprecated Client API vs new and Latest Client API’S Table

Check1: How to Replace Deprecated Client Apis to New

  1. First approach is to use Upgrade examiner, please check out our last blog as below how to use Fast track and use upgrade examiner as a starter.

    Click Here: http://microsoftdynamics.in/2020/07/16/migration-from-legacy-webclient-to-uci-ask-for-fasttrack-and-upgrade-examiner-not-confident-on-transition-ask-microsoft/

  2. Once you changed the latest client API’s there is a major change with Xrm.Page
    -> 1st enable checkbox ” Pass execution context as the first Parameter -> ExecutionContext is Automatically passed as 1st parameter as below

Check2: Full Deprecated Client API vs new and Latest Client API'S Table

Objective Using Xrm.Page (Deprecated Client API) Using formContext (Replacement Client API)
Simple JavaScript function function demoFunction(){ } function demoFunction(eContext){
//Get form context
var formContext = eContext.getFormContext();
}
Disable/lock field, “addRegions”, for selection Xrm.Page.getControl("addRegions").
setDisabled(true);
formContext.getControl("addRegions").
setDisabled(true);
Enable/unlock field, “addRegions”, for selection Xrm.Page.getControl("addRegions").
setDisabled(false);
formContext.getControl("addRegions").
setDisabled(false);
Hide field, “addRegions” Xrm.Page.getControl("addRegions").
setVisible(false);
formContext.getControl("addRegions").
setVisible(false);
Show field, “addRegions” Xrm.Page.getControl("addRegions").
setVisible(true);
formContext.getControl("addRegions").
setVisible(true);
Get lookup field “region”, and its properties var regionLookup = Xrm.Page.
getAttribute("region").getValue();
if (regionLookup != null) {
var name = regionLookup[0].name;
var guid = regionLookup[0].

id.slice(1, -1);
var entityType =

regionLookup[0].entityType;
}
var regionLookup = formContext.
getAttribute("region").getValue();
if ( regionLookup != null) {
var name = regionLookup[0].name;
var guid = regionLookup[0].

id.slice(1, -1);
var entityType =

regionLookup[0].entityType;
}
Remove option, 15220000, from ‘showRegions’ option set. Xrm.Page.getControl("showRegions").
removeOption(15220000);
formContext.getControl("showRegions").
removeOption(15220000);
Add option, 15220001 (with text: ‘Africa’), to ‘showRegions’ option set. Xrm.Page.getControl("showRegions").
addOption({
value:15220001,
text:'Africa'});
formContext.getControl("showRegions").
addOption({
value:15220001,
text:'Africa'});
Show tab, with logical name “regionsTab” Xrm.Page.ui.tabs.get("regionsTab").
setVisible(true);
formContext.ui.tabs.get("regionsTab").
setVisible(true);
Hide tab, with logical name “regionsTab” Xrm.Page.ui.tabs.get("regionsTab").
setVisible(false);
formContext.ui.tabs.get("regionsTab").
setVisible(false);
Show section “regionsTab_regSection”, located in tab “regionsTab” Xrm.Page.ui.tabs.get("regionsTab").
sections.get("regionsTab_regSection").
setVisible(true);
formContext.ui.tabs.get("regionsTab").
sections.get("regionsTab_regSection").
setVisible(true);
Hide section “regionsTab_regSection”, located in tab “regionsTab” Xrm.Page.ui.tabs.
get("regionsTab").sections.
get("regionsTab_regSection").
setVisible(false);
formContext.ui.tabs.
get("regionsTab").sections.
get("regionsTab_regSection").
setVisible(false);
Count number of records on sub-grid called “demo-grid” var count = Xrm.Page.
getControl("demo-grid").getGrid().

getTotalRecordCount();
var count = formContext.
getControl("demo-grid").getGrid().
getTotalRecordCount();
Deprecated Client API Replacement Client API Comments
Xrm.Page Forms: ExecutionContext.getFormContext
Commands: Send it as the PrimaryControl parameter
Use of the Xrm.Page object as a static access to the primary form context is still supported to maintain backward compatibility with the existing scripts. Based on the feedback, we understand that the usage of Xrm.Page is high, and it won’t be removed as soon as some other client API methods listed in this section. We encourage you to use the new way of getting form content where possible. More information: Client API form context
Although Xrm.Page is deprecated, parent.Xrm.Page will continue to work in case of HTML web resources embedded in forms as this is the only way to access the form context from the HTML web resource.
Xrm.Page.context Xrm.Utility.getGlobalContext Allows access to the global context without going through the form context.
Xrm.Page.context.getQueryStringParameters formContext.data.attributes The formContext.data.attributes API will make retrieval of non-entity bound data consistent across entity forms, metadata-driven dialogs, and task-based flows. The data will be a combination of custom values sent using the query string and what was specified in the parameters in the openForm method.
Xrm.Page.context.getTimeZoneOffsetMinutes globalContext.userSettings.getTimeZoneOffsetMinutes Moved to globalContext.userSettings
Xrm.Page.context.getUserId globalContext.userSettings.userId Moved to globalContext.userSettings
Xrm.Page.context.getUserLcid globalContext.userSetings.languageId Moved to globalContext.userSettings
Xrm.Page.context.getUserName globalContext.userSettings.userName Moved to globalContext.userSettings
Xrm.Page.context.getUserRoles globalContext.userSettings.securityRoles Moved to globalContext.userSettings
Xrm.Page.context.getIsAutoSaveEnabled globalContext.organizationSettings.isAutoSaveEnabled Moved to globalContext.organizationSettings
Xrm.Page.context.getOrgLcid globalContext.organizationSettings.languageId Moved to globalContext.organizationSettings
Xrm.Page.context.getOrgUniqueName globalContext.organizationSettings.uniqueName Moved to globalContext.organizationSettings
Xrm.Page.data.entity.getDataXml No change in the method, but use “typename” instead of type for lookup attributes.
GridRow.getData GridRow.data GridRow is essentially a form context. This change unifies the interface of GridRow with formContext.
GridRowData.getEntity GridRowData.entity GridRowData is form data. This change unifies the interface of GridRowData with formContextData.
Xrm.Mobile.offline Xrm.WebApi.offline Moved the offline-related methods under Xrm.WebApi.offline
parent.Xrm Use one of the following:

a) Use a custom control created using Power Apps component framework instead of HTML web resources.

b) On forms, use the getContentWindow method of the web resource control.

c) If the getContentWindow method doesn’t work, you can use parent.Xrm to get to the Xrm object inside an HTML web resource. If the HTML web resource is opened in a new window then you should use opener.Xrm instead.

Earlier: An HTML web resource may interact with the Xrm.Page or Xrm.Utility objects within the form by using parent.Xrm.Page or parent.Xrm.Utility.

Now: parent.Xrm.* will work if the HTML web resource is loaded in a form container. It won’t work for HTML web resources that are stand alone, or referenced from the site map or any other places.

NOTEparent.Xrm will be removed after the removal of the ClientGlobalContext.js.aspx page; dates yet to be announced.

addOnKeyPress Use a custom control created using Power Apps component framework
fireOnKeyPress Use a custom control created using Power Apps component framework
removeOnKeyPress Use a custom control created using Power Apps component framework
showAutoComplete Use a custom control created using Power Apps component framework
hideAutoComplete Use a custom control created using Power Apps component framework
Xrm.Utility.alertDialog Xrm.Navigation.openAlertDialog The new signature is consistent with other APIs (openForm) and takes a new set of parameters for flexibility.
Xrm.Utility.confirmDialog Xrm.Navigation.openConfirmDialog The new signature is consistent with other APIs (openForm) and takes a new set of parameters for flexibility.
Xrm.Utility.getBarcodeValue Xrm.Device.getBarcodeValue Moving device-related actions to Xrm.Device
Xrm.Utility.getCurrentPosition Xrm.Device.getCurrentPosition Moving device-related actions to Xrm.Device
Xrm.Utility.isActivityType Xrm.Utility.getEntityMetadata The isActivityType method is synchronous so it was suitable for ribbon rules. However, the replacement method, getEntityMetadata, is asynchronous, and is not suitable for ribbon rules.
Xrm.Utility.openEntityForm Xrm.Navigation.openForm Moving navigation actions to Xrm.Navigation
Xrm.Utility.openQuickCreate Xrm.Navigation.openForm Moving navigation actions to Xrm.Navigation
Xrm.Utility.openWebResource Xrm.Navigation.openWebResource Moving navigation actions to Xrm.Navigation
Note: This API returns VOID in Unified Interface.
globalContext.organizationSettings.baseCurrencyId globalContext.organizationSettings.baseCurrency The replacement method lets you access the display name along with the ID of transaction currency.
globalContext.userSettings.securityRoles globalContext.userSettings.Roles The replacement method lets you access the display name along with the ID of the security roles.
globalContext.userSettings.transactionCurrencyId globalContext.userSettings.transactionCurrency The replacement method lets you access the display name along with the ID of transaction currency.
getData and setData for Silverlight web resources None Silverlight is no longer supported. These methods won’t be available after October, 2020.
formContext.data.entity.save formContext.data.save
ClientGlobalContext.js.aspx None The ClientGlobalContext.js.aspx page is built on the legacy web client infrastructure. As the legacy web client is deprecated and scheduled to be unavailable effective December 1, 2020, the ClientGlobalContext.js.aspx page will also be removed along with the legacy web client on December 1, 2020.
getObject getContentWindow

Reference: https://docs.microsoft.com/en-us/power-platform/important-changes-coming#some-client-apis-are-deprecated

The post Migration from Legacy WebClient to UCI – Deprecated Javascript (Client Api) Collection Book , Replace Deprecated Client API To New and latest Client Api’s appeared first on Microsoft Dynamics 365 Blog.

]]>
4081
Pass executionContext or formContext from Ribbon WorkBench button in UCI Unified client interface https://microsoftdynamics.in/2020/08/22/pass-execution-context-or-form-context-from-ribbon-workbench-in-uci-unified-client-interface/ Sat, 22 Aug 2020 10:32:24 +0000 http://microsoftdynamics.in/?p=4071 With Depreciation of xrm.page which was used to get attribute/property of an item of form. We all have switched to the latest FormContext which require executionContext need top be passed as a Parameter "Pass Execution Context as First Parameter" from event

Now how to pass ExecutionContext for the javascript action used for a Button on Ribbon Workbench

1 Open Ribbon WorkBench
2 Select Solution contains entity and components
3 Add button, Add command
4 Now add Javascript Action and select Javascript and Function
5 Now Click on Add Parameter

The post Pass executionContext or formContext from Ribbon WorkBench button in UCI Unified client interface appeared first on Microsoft Dynamics 365 Blog.

]]>

With Depreciation of xrm.page which was used to get attribute/property of an item of form. We all have switched to the latest FormContext which require executionContext need top be passed as a Parameter "Pass Execution Context as First Parameter" from event

Now how to pass ExecutionContext for the javascript action used for a Button on Ribbon Workbench

From Event Handler Property we can simply enable checkbox  “Pass execution context as first parameter ” and use that for Form Context as Below

And we can get FormContext from 1st parameter Execution Parameter.

function readXML(executionContext) {   
 if (executionContext !== null) {

             formContext =  executionContext.getFormContext();
   }
alert("executionContext  is null ");
}

How to Pass ExecutionContext or FormContext for a JS action on the button in Ribbon Workbench

  1. Open Ribbon WorkBench
  2. Select Solution contains entity and components
  3. Add button, Add command
  4. Now add Javascript Action and select Javascript and Function
  5. Now Click on Add Parameter
  6. Add CRM Parameter

  7. and select Primary  Control

1 thing to remember, like for Form Button , always use PrimaryControl as Form Control

function readXML(executionContext) {   
 if (executionContext !== null) {

             formContext =  executionContext;  //PrimaryControl
   }
alert("executionContext  is null ");
}

The post Pass executionContext or formContext from Ribbon WorkBench button in UCI Unified client interface appeared first on Microsoft Dynamics 365 Blog.

]]>
4071