Thursday 30 April 2020

Enable/Disable Rich Text Editor for Notes on Timeline

Hi Everyone,

Today I was checking System Settings to configure something and I found a setting to enable or disable Rich Text Editor for Notes on Timeline. Somehow I feel we don't need a setting for this, who wants disable this wonderful feature. However, if anyone is looking to disable to Rich Text Editor check this out.


Hope this helps.

--
Happy 365'ing
Gopinath

Monday 27 April 2020

Check the status on Solution Import - Dynamics 365 Customer Engagement

Hi Everyone,

Certainly, everyone Dynamics 365 CE Consultant/Architect must have started importing the solutions and went for dinner, lunch, break or checked the mobile thinking the solution import would take some time. After they come back, the import might be still going on and at that time everyone would be eager to check what exactly the status of the import.

Also sometimes, knowingly or unknowingly you might cancelled/closed import wizard thinking let's start the import again and when you try again the system must have shown a message saying "The import is in progress." and you never know when it completes.

We have a solution for this, we can check the progress of the solution from Import Jobs. Open Advance Find and look for import Jobs, add a filter to show the records created on from last one or two hours (I normally apply the filter on Created on, if you want to get the results and sort on CreatedOn column). You will see the results showing percentage.


Hope this helps.

--
Happy 365'ing
Gopinath

Open subgrid record as a Modal Popup in Dynamics 365

Hi Everyone,

The most awaiting feature Modal popups are available in Dynamics 365 now and made our lives easier for many things, we are getting many requirements to open the records as a popup where we have control on the parent record and hence not loosing the changes.

One of the requirement I heard today was opening the record as popup from Subgrid. Initially we thought there is no way but after quick check we are done with the job with the help of the Editable Grids.

Let's say there is a subgrid on Account as Contact and whenever user selects the record we can make use NavigateTo function and open the selected record as a popup. We have to put below code on the RecordSelect event of the subgrid.

function onRecordSelect(executionContext) {
    var selectedRecord = executionContext.getFormContext().data.entity;
    var Id = selectedRecord.getId();
    var entityName = selectedRecord.getEntityName();
    var pageInput = {
        pageType: "entityrecord",
        entityName: entityName,
        entityId: Id
    };
    var navigationOptions = {
        target: 2,
        height: { value: 70, unit: "%" },
        width: { value: 70, unit: "%" },
        position: 1
    };
    Xrm.Navigation.navigateTo(pageInput, navigationOptions).then(
        function success() { },
        function error() { }
    );

}


Hope this helps.

--
Happy 365'ing
Gopinath

Sunday 26 April 2020

Get Security Roles of the User - Dynamics 365

Hi Everyone,

Today one of the Developer in my team was stuck with one issue and the issue was about validating users security roles and allowing the user to perform some operation. User was associated with only 2 security roles and the below line of code was giving 4 GUIDs. When we checked the code, whatever he was saying was correct. After few mins, we came to know that this line gets the roles of the Teams where user is associated along with roles that were given to the users.

Xrm.Utility.getGlobalContext().userSettings.securityRoles

Hope this helps.

--
Happy 365'ing
Gopinath

Tuesday 21 April 2020

Xrm.Navigation.openForm - Open the record with specific Business Process Flow

Hi Everyone,

Today I got some strange requirement that to open the record by setting up to specific Business Process Flow on UI when clicked on the lookup from the child form.

We need to understand multiple new things from doing this.

1) addOnLookupTagClick event - Refer this to understand more about. By this event, we can prevent the default behavior of the click event on lookup.
2) OpenForm - As we all know that we have to use Xrm.Navigation.openForm for opening the records and fortunately we can pass the ProcessId and ProcessInstanceId in the entityFormOptions. In case, if you want to open the record in a specific stage, We have pass stageID.

Here is the piece of code for the same and I have called this code on the load event.

function onLoadOfOpportunity(executionContext) {
    var formContext = executionContext.getFormContext();
    formContext.getControl('new_parentopportunity').addOnLookupTagClick(function (e) {
        e.getEventArgs().preventDefault(); // disables the default behaviour of opening the record
        // Get the lookup record 
        var lookupRecord = e.getEventArgs().getTagValue();
        // Xrm.Navigation.openForm(entityFormOptions, formParameters).then(successCallback, errorCallback);
        var entityFormOptions = {};
        entityFormOptions["entityName"] = "opportunity";
        entityFormOptions["entityId"] = lookupRecord.id;
        entityFormOptions["processId"] = "EC985A4F-E5E2-489F-A13D-4AFBECD6A769";
        entityFormOptions["processInstanceId"] = "F532CF05-8B83-EA11-A811-000D3A3E14C7";
        // Open the form.
        Xrm.Navigation.openForm(entityFormOptions).then(
            function (success) {
                console.log(success);
            },
            function (error) {
                console.log(error);
            });
    });

}

When I open the record from the HomePage grid. You see the process as "Opportunity Sales Process".

The same record if open from the lookup, you see "Second Business Process Flow"


Hope this helps.

--
Happy 365'ing
Gopinath

Tuesday 7 April 2020

Status of the Activities on Timeline is back with Dynamics 365 2020 Wave 1 Release

Hi Everyone,

Today I was testing something on 2020 Wave 1 Release version of Dynamics 365 and you know, I am able to see the Status of the activities on the timeline. It was there on some older versions and suddenly disappeared. Not sure what happened and it was very hard to find what are the pending activities to take an action without status.

And, now it is back. Thanks for fixing it.
Hope this helps.

--
Happy 365'ing
Gopinath

Environment Variables - Power Apps/Dynamics 365

Hi Everyone,

I was going through the solution components today and found Environment Variables when clicked on New button after opening the solution.

Explored little bit about it and here are the takeaways.

From ages, we are using custom entities for storing configurations which might differ from environment to environment and using them in Plugins, Workflows, JavaScript and now in Flows and Powerapps as well.

When should we use Environment Variables?
  • When an input parameter needs to change across environments and should not be hard-coded. For example, a URL that points to a different resource in development and production environments.
  • If you’re building a solution where your customer is required to provide an input value.
  • When multiple components require the same input. Instead of entering that input multiple times, reference the environment variable. If the value needs to change, make an update in one place.
  • If you need to update configuration values without modifying code or if the person managing the configuration is not familiar with coding. For example, a plugin that references a blob store location could be updating without directly modifying the plugin.

When shouldn’t we use Environment variables?
  • To transport secure data such as passwords or other secrets.
  • If several values are required for one definition.

Let's go ahead and create an Environment Variable to understand it more.

It can handle below datatypes.


Up on creating 'Environment variable', a new record gets added to both OOB 'Environment Variable Definition' entity and 'Environment Variable Values' entities.

'Environment Variable Values' is child to the 'Environment Variable Definition' entity.

What is Default Value?
This field is part of the Environment variable definition entity is not required. Set a default value for the value to be used in production or when the values should remain the same across different environments. The Environment variable definition will be represented in the customizations.xml in your solution file

What is Current Value?
This field is optional and is a part of the “Environment variable value” entity. Also known as a current value or override value. Set this when you’d like to override the default value in your current environment. Remove the value from your solution if you don’t want this value used in the next environment. While it is typically unhealthy to modify solution components in production environments, you may enter a current value in the production environment without introducing unhealthy behaviors to the consuming component or the Environment variable definition. Note: a 1:1 relationship is currently enforced between the Environment variable definition and the Environment variable value. A value also cannot exist without a definition.

Why is there a default value and a value? This allows you to service the definition and default value separately from the current value. It also allows us to extend the functionality in the future to support multiple values scoped to a specific run time context. A separate JSON file added to your solution file that stores the values.

Note: The above is only a recommendation on how to use default values and values. If using both, you will need to handle the logic to determine which value should be used. 

To test this, I have created a flow and retrieved Environment Variable Definition by filtering the SchemaName as below.

In the above example, I applied query on "Environment Variable Definition" entity and if you have current values, you have to add one more List Records step in the Loop to query "Environemnt Varialble Value" and  in the Filter query, enter _environmentvariabledefinitionid_value eq and add the Environment Variable Definition from the dynamic content list.

We can move these from one environment to other using Solution Import. When we export the solution, you will see a separate JSON added in the solution.

Note: This is still under preview, please check this link for more information.


Hope this helps.

--
Happy 365'ing
Gopinath

Sunday 5 April 2020

Advance Filtering in Dynamics 365 2020 Wave 1 Release

Hi Everyone,

Today I was doing some testing, observed a filter just beside Search box on the Grid and when I clicked it has opened as a popup.

Played little bit with that and you know it works like a charm. It allows us to build simple to complex filters without even opening Advance Find.

You can add more filters by selecting a column to filter on, then choosing an operator and selecting a value. The set of operators available on a column adjust intelligently according to the data type of the column to help you stay productive.

Individual conditions can be grouped and nested to create expressions to apply the right lens to your dataset.
Once the filters are applied, you can easily clear them using the Clear filters button, which resets the view back to its original definition. The asterisk next to the view name indicates unsaved changes, which can be easily saved into a new personal view that is always available in the view selector.

Hope this helps.

--
Happy 365'ing
Gopinath