Blog, Development

What’s new in D365 2020 Wave 1 release for front-end developers

There are a lot of different blog posts and video reviews of features available as a part of the Dynamics 365 2020 Wave 1 release. I played with this release a bit and found 2 client-side code enhancements that can be interesting (or even useful) for developers.

I wrote that Xrm.Navigation.navigateTo can be used to open Html web resources in modal dialog in my previous post. As a part of the new release there will be the possibility to open the record in a similar manner. The following code opens the account record in a modal window:

One issue I found here is that when the dialog is closed using “X” button, or the record is deleted using “Delete” button from command bar – the promise will remain unresolved so there is no way to handle these scenarios at the moment. Source information is available here – https://docs.microsoft.com/en-us/powerapps/developer/model-driven-apps/customize-entity-forms#open-an-existing-record

The second interesting feature introduced is the possibility to override the “onclick” event on the record selected in lookup. Default behavior – app navigates you to that record. Now it’s possible to cancel that event or override the behavior. Here is the code:

More information about this event is available here – https://docs.microsoft.com/en-us/powerapps/developer/model-driven-apps/clientapi/reference/events/onlookuptagclick

I thought that it would be really cool to combine those 2 pieces together to override behavior of the lookup item click. Here is the code for it:

The following screen capture demonstrates the result:

6 Comments on “What’s new in D365 2020 Wave 1 release for front-end developers

  1. Great information Andrew,

    I’m new to this whole world and I was playing around with this code. Everything seems to be correct but for some reason it wants to skip over my navigationOptions when it comes time to set the modal. Am I missing something?

    function onFormLoad(executionContext) {
    var formContext = executionContext.getFormContext();
    var lookupControl = formContext.getControl(“cr247_relatedaccount”);
    lookupControl.addOnLookupTagClick(onLookupClick);
    }

    function onLookupClick(executionContext) {
    debugger;
    executionContext.getEventArgs().preventDefault();
    var recordReference = executionContext.getEventArgs().getTagValue();

    var pageInput = {
    pageType: “entityrecord”,
    entityName: recordReference.entityType,
    formType: 2,
    entityId: recordReference.id

    };

    var navigationOptions = {
    target: 2,
    position: 2,
    width: {
    value: 80,
    unit: “%”
    }
    };

    Xrm.Navigation.navigateTo(pageInput, navigationOptions);
    }

  2. Andrew,
    Have you found the form within the modal dialog to be responsive to Javascript? e.g. A form that hides/shows tabs via script is opened in a modal dialog and shows/hides your desired tabs appropriately .
    I really like the functionality you presented in this post and have a potential use case for this exact scenario but have not had free time to play around with it myself. Just wondering if you happened to notice this while testing with modal dialogs.

    1. Scott,
      I haven’t thought about this usecase. I will check if it could be received in the script or not.
      Andrew

  3. Hello Andrew,
    is there a way to set formid to be opened ?
    Something like:
    Xrm.Navigation.navigateTo({
    pageType: “entityrecord”,
    entityName: tagValue.entityType,
    formType: 2,
    formId: ‘321873-821739127-39821’,
    entityId: tagValue.id
    }

    1. Yuriy,
      Thanks for a great question. I did the fast check and formId parameter works like a charm. I will update the post.
      Andrew

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.