D365 Quick Tip: Getting layoutXml from DevTools

Most times when you want to use AddCustomView() method to a Dynamics 365 control, you need to pass layoutXml to the method that will show the view you define.
fromCOde

There’s an easier trick than writing this up.

Select your View

Assuming, you have an Advanced Find view open in the window which you want as a layoutXml of, on the same, press F12 to open Dev Tools. Select the selector.
selector

And on the Advanced Find window, select Body section
andSelectBody
Click on it, and the par will be selected in the Console of the Dev Tools.

Once this is available, search for layoutXml and cycle through the results to go to the last result.
selectFromConsole

select the “value” part. That is your layoutXml. Hope this helps.

Advertisements

Quickly get the right .NET Framework version to work with CoreAssemblies 9.0.2.x

Plugin development is a hassle if you don’t start of with getting the correct assemblies in place before you start writing your plugin code.

Best way is to get all of that from the NuGet Manager in VS. Preferably, we all pick the latest version from the NuGet Manager and pick Microsoft.CmSdk.CoreAssemblies. With 9.0.2.x version for v9 D365 environments, you might need to be careful with the .NET Framework version too. So, here’s a quick post about that.

Let’s say you pick Microsoft.CmSdk.CoreAssemblies

coreAssemblies

While installing, you get the below error
error

This is because your VS Project might not be on or might not have the correct .NET framework installed. If you go to Project properties, you can check that.

What version do you need?

Nuget.org will tell you about the version of .NET Framework required for that assembly.
correctVersion

Getting .NET 4.6.2

You can download among the different versions of Developer Packs available across your VS versions from the link below –

Link: https://dotnet.microsoft.com/download/visual-studio-sdks?utm_source=getdotnetsdk&utm_medium=referral

Once you have the correct version, 4.6.2 in this case, you can simply select that Developer Pack and download.

Alternatively, you can also click on Install other frameworks… to get to the link (note that 4.6.2 is not yet installed for me)
installOtherFrameworks

Once you see the downloaded Setup in your browser as shown below, simply run it –
downloadedPack

It sets up like a typical Windows application. Once done, you can check your project properties and select the .NET Framework version you installed.
4.6.2NowInstalled

Re-install Assembly

And when you now try to re-install the assembly, it should be successful and you’ll get all the references you need in your plugin.
successfullyInstalled

Hope this will help! 🙂

“Enable Mobile Offline” for D365 for Phones app in D365 v9.x

Finally! After much await and as April 2019 kicks in, the Mobile Offline capability for D365 Apps is finally setting in. But remember, this is in preview as of April 2019 and is not recommended for Production use.

Here’s you can enable Mobile Offline for any Dynamics 365 App

  1. You can see that you can now turn on Enable Mobile Offline for a certain app.
    beforeEnable
  2. Once you select it to tick, you’ll need to select a Mobile Offline Profile. Out-of-the-box, I have selected Sales Sample.
    selectedProfile
  3. These profiles are available for creation and edit in your Default Solution if you go and see
    profileInSolution
  4. And, they specify what properties should the offline mode have. Also, make sure the Users who should have this capability should be added to Users grid as shown below in the Offline Profiles.
    insideProfile
  5. Once done, save and Publish your Unified Interface app in the App Designer. Make sure the Profile is Published too!

Running Mobile Offline

When you open the Mobile App for that user, there’ll be a notification pop-up saying that changes on the org were made and you’ll need to update the same.

And when the update is complete, you’ll see the entities which are enabled for offline like the ones marked below (by a wifi signal icon)

 

So, let’s assume you are offline, you won’t be able to view records that are not enabled for Offline and will see the below error instead.

 

And the entities like Accounts, which is enabled for Offline, you’ll see the record as below

To summarize, that was the Offline for Mobile which is in preview as of April 2019. Hope this helps!

Show specific entities in Activity Party List Lookup in D365 Activity entity

Out-of-the-box, D365 Activity Party List field, say, Appointment’s Required/Optional Attendees fields lets you choose among multiple Activity Party enabled entities when you want to select records. And perhaps you don’t even want users to select what’s not relevant.

default

Let’s look at how we can show only the required entities in the selection list.

Before that, if you want to check how you can enable custom entities for the Activity Party, you can refer this post of mine – Enable entity for Party List selection in Appointment

Hide entities from the Activity Party List field

This can be achieved by writing a simple JS code and calling it onLoad of the Appointment form where the Party List field exists.

  1. Let’s say you only want to show the entities Lead and Contact in the Required Attendees Party List field
  2. Here’s the JS code that goes on the onLoad function of the Appointment form
    // JavaScript source code
    oAppointmentFormCustomization =
    {
    filterRequiredAttendees: function () {
    Xrm.Page.getAttribute("requiredattendees").setLookupTypes(["lead","contact"]);
    }
    };

     

  3. And call the method filterRequiredAttendees onLoad as below
    onLoad
  4. The Appointment’s Required Attendees field will show only the entities you provided in the setLookupTypes([“lead”,”contact”]);
    filtered

Hope this helps!

Use Read-Only grid among Editable Grid enabled entities in D365

When you enable Editable Grid for an entity, all the public views become Editable Grids, correct?

And if you wonder if you can keep certain grids as Read-Only and the rest as Editable, your assumption is correct. Here’s what this blog is about.

You can still go back and select a particular grid which you want to keep as a classic Read-Only grid

  1. Let’s say you have added the Editable Grid under Controls. This will apply Editable Grids for all the Views on that entity.
    enabledEditable
  2. And you want Vendors view, for example, to show the classic Read-Only grid, open it up.
    vendorView
  3. Select Custom Controls.
    customControls
  4. And force-add another Read only grid even if it says the Default one is already selected.
    forceAddRead-Only
  5. Save and Publish you changed and check
    classicGrid
  6. And the rest of the grids will continue to be Editable Grids
    editableOthers

Note: I tried this on the Unified Interface and this works. Somehow, it didn’t work on the Classic Web UI.

 

Hope this helps!

Get SharePoint Document Location link on field on create in D365

I’ve been working on getting the SharePoint Document’s link to get back into D365 but looks like it can’t come back and get tagged to the record it was created from.

I tried to fire off a plugin on SharePoint Document record create, but in vain. Flow didn’t do justice since SharePoint Document entity doesn’t support Change Tracking.

So, I retrieved the Absolute URL of the “SharePoint Document Location” entity on it’s create itself so that I have the link once the record is created. And click that link to open the folder in SharePoint.

Workflow to wait and then fetch

So if you immediately make a call to retrieve the Absolute URL in the plugin code you’ve written on Create won’t work because Absolute URL gets created moments after the actual Location record is created unlike being passed in the execution context.

My approach is to fire the workflow on the create of the SharePoint Document Location record and Wait for 1 minute.

wfBody

After 1 minute, set off the flag to call the plugin and fetch the Absolute URL as shown below –

updateFlag

Retrieve Absolute URL in Plugin

You can use RetrieveAbsoluteAndSiteCollectionUrlRequest message to retrieve the SiteCollection URL and the Absolute URL of the document folder of the record

retrieveAbsolute

 

Working

  1. When you open the Document sub-grid on the record for the first time, a Document Location record is created –
    openForFirst
  2. The workflow designed above will run and fire off the plugin after 1 minute. The plugin will then make the message request go through to get you the Absolute URL as below –
    link2
  3. And probably you can use that link to open up the folder by clicking on the field that has this URL or send it across in email to internal users (whatever suits your requirements)
    linkInField
  4. It will open up the SP folder for that record and will have all the documents you attach in the Document sub-grid on the record.
    spFolder

Hope this helps!

D365 Quick Tip: Shortcut to Settings from the Unified Interface

If you’re spending time looking and wondering that you always need to go to the app switcher to go the Settings from the Unified Interface, you need to do the following –

Once you are in the Unified Interface, click on the Gear icon next to the help icon on top-right corner as shown below and click Advanced Settings

advancedsettings

 

Right on the next tab, Settings with the classic UI is shown –
fullsettings

And there’s nothing else on that SiteMap.

 

And that’s it! 🙂