Tip #854: Beware of Using Xrm Client Functions As Callbacks

Today’s tip comes from the tipper who, despite his affinity with Microsoft Flow, earned his place amongst the real developers fair and square, and who is now known as Daryl “Always Raising” LaBar.

Daryl, you have the floor

Writing clean code is constantly at the for-front of developers, and usually, “less” code generally results in “cleaner” code. So when coding on-change event’s it’s very typical to see code like this:

Xrm.Page
  .getAttribute("fieldname")
  .addOnChange(Xrm.Page.ui.refreshRibbon);

favored over code like this:

Xrm.Page
  .getAttribute("fieldname")
  .addOnChange(function (){ 
	Xrm.Page.ui.refreshRibbon(); 
  });

(or even for the “cooler” JavaScript developers)

Xrm.Page
  .getAttribute("fieldname")
  .addOnChange(() => { 
    Xrm.Page.ui.refreshRibbon(); 
  });

Which works great, until it doesn’t. And it doesn’t work great in the interesting case when calling refresh, which then triggers a previously defined onChange event. In this particular scenario, the Xrm object model defined as the callback handler is no longer valid, due to a new one taking it’s place.

This would result in the code from the first example throwing this error: “Unable to get property ‘refreshRibbon’ of undefined or null reference”, but the second and third examples would execute normally as expected. This is because the callback is pointing to a function, which gets the current version of window.Xrm, which is valid, unlike the first example, where the call back is pointing to a specific version of Xrm (and in this scenario, an older invalid version).

So feel free to be “cute” in your OnChange callbacks… just not “too cute” and remember: Friends don’t let friends create onChange events pointing directly to Xrm functions.

Tipp Jaar’s $0.02 + tax

I don’t believe the last syntax, however cool and cute it is, would work in an obscure browser called Internet Explorer, including version 11. But then again, as the name suggests, that browser is for exploring Internet and not for doing any work around Dynamics 365.

Tweet about this on TwitterShare on FacebookShare on Google+

Tip #853: Use caution with the View Layout Replicator

This morning we released episode 49 of CRM Audio (the original CRM MVP podcast). One of the topics we discussed with Andrii Butenko was our go-to tools in the XRM toolbox, and one of the tools mentioned was the View Layout Replicator. This power tool has saved many a CRM configurator hours of tedious frustration by making it super easy to apply the same field layout to multiple system views.

This tool should be used with care, as it can be used to make some unsupported changes to system views that can negatively impact user experience.

  • Quick search view: if you add related entity fields to an entity Quick Search View, the view will give you an “entity doesn’t contain attribute with Name = ” error message.
  • Lookup view: If you change the lookup view for an entity to have anything other than the primary “name” attribute, lookup fields that reference that entity will not show the correct value in the lookup field.

Both of these changes are things that cannot be done with the standard application configuration tools. So go ahead and replicate those view layouts, just proceed with caution.

Tweet about this on TwitterShare on FacebookShare on Google+

Tip #852: Where the last used forms are

Dynamics 365 (and CRM before it) “remembers” the most recent form that a user accessed for each entity. If a user has access to more than one form in the Account entity, the next time he or she opens an Account record, they will see the form that they last accessed. The user can switch forms manually, and then the form will default to the new form the next time they open a record.

The challenge is what happens when you introduce a new form, and you have existing users that have already used the old form? Unless you are deprecating the old form, the users will still see the old form, even if you set the new form to a higher priority in the entity form order.

In the words of GI Joe, “Knowing is half the battle,” the first step is to find out which users have the old form as their default form.

If you use Dynamics 365/CRM On Premises, the answer can be found by querying the UserEntityUISettingsBase table. In the following example, we can see who has the main Account form as their last viewed form:

SELECT 
  RecentlyViewedXml, LastViewedFormXml, 
  UserEntityUISettingsId, LookupMRUXml, 
  InsertIntoEmailMRUXml, VersionNumber, 
  OwningBusinessUnit, OwnerId, 
  ObjectTypeCode, ReadingPaneXml, 
  TabOrderXml, MRUXml, ShowInAddressBook, 
  OwnerIdType
FROM
  UserEntityUISettingsBase
WHERE
    (ObjectTypeCode = 1)
AND LastViewedFormXml = 
   '<MRUForm><Form Type="Main" 
     Id="8448b78f-8f42-454e-8e2a-f8196b0419af" />
   </MRUForm>'

Thanks to Scott Jung for sending us this tip.

Tweet about this on TwitterShare on FacebookShare on Google+

Tip #851: All Themed Up and Nowhere to Go…

In many Dynamics 365 implementations one of the customizations which can have an enormous impact to user adoption is the customization of the CRM Theme.  However, changes made to an organization’s theme are not solution aware.  As a result, each theme customization must be made manually in each environment.  Now, if there were no other way to handle this, it wouldn’t be much of a tip…now would it?

I have found a simple way to update additional environments with theme customizations using OOB methods and tools.  First the web resource for the logo should be imported into the forward environments (Test and Production, for example), this will help us later.  Once the theme has been defined, tested and published, we will need to export the settings to Excel.  Personally, I like to use the Data Import Template rather than creating a custom view and adding all the needed columns and then exporting to Excel.  (To download the Data Import Template, navigate to Settings > Data Management > Templates for Data Import and select Themes.) Once the settings are in the Excel sheet, simply import the file into the new environment to update the new custom theme.  **NOTE** It is critical to have the web resource for the logo published prior to the import of the Excel file.

themeexcel

 

Tweet about this on TwitterShare on FacebookShare on Google+

Tip #850: Mobile app–why so negative?

I have a history with the Dynamics 365 mobile app, and while I don’t think it is perfect (I too get frustrated waiting for metadata to download sometimes), it has come a long way. However, it continues to get negative reviews in the various app stores. Some of this feedback is deserved, while some of the reviews are due to client-specific factors that, in my opinion, unfairly bring down the app rating for the Dynamics mobile app. In this post I will lay out some of the reasons for this phenomenon, and in future posts I plan on responding to specific reviews. And in the process, maybe CRMTOD readers might get some useful tips on how not to be “that guy.”

1. It’s complicated

Dynamics, that is. Dynamics 365 is a large platform that can do anything you want to. From the standard account and opportunity management to strange XRM scenarios, Dynamics allows administrators to create very complicated configurations, including custom plugins, JavaScript, embedded web resources and iframes. Overly complicated or unsupported customizations can complicate your mobile experience. Dynamics also has a very comprehensive security structure, comprised of multiple security tools, such as security roles, business units, access teams, hierarchical security, and sharing. These tools can be used to handle virtually any security scenario, but can also introduce complexity into your Dynamics deployment (try an prove who has inherited record shares to a cascading grandchild, for example). Frequently, mobile issues are a canary in the coal mine indicating configuration issues in the environment you are trying to connect to. Rather than being a negative mark against the mobile app, they may be a indicator of the quality of the CRM configurator that configured your form.

2. It’s ambitious

Dynamics 365 mobile is built upon the dream of “configure once, deploy anywhere.” This means that the same form you have in Dynamics 365 browser is the form you get in mobile. While the merits of this approach are debatable (see Resco for a different approach), it means that your forms must be configured in a way that gives you good mobile experience. And it also means that you also need to know about the configuration options that can be used to simplify your mobile experience.

Dynamics 365 is also ambitious in its goal of providing “full” application access in small mobile form factor. When it was originally released, Dynamics CRM for tablets had a long list of entities and features that did not work on mobile. As mentioned in Tip 710, that list is now much smaller than it used to be. Features like document management and OneNote are now available, but you have to know how to turn them on. Maybe Microsoft could get better reviews by limiting the functionality of the app, but I’m glad to have a fully featured mobile experience. Anybody remember Mobile Express?

3. It’s better than it used to be

Each release of Dynamics 365 mobile sees dramatic improvements in mobile. In Dynamics 365, we got a much better start experience, allowing users to quickly access frequently used records and quickly create notes, and the new compact view makes the app more usable and less “swipy.” Many of the quirks I complained about in the CRM Mobile Survival Guide have been addressed.

But it’s not as good as it will be. If you find that it doesn’t meet your requirements today, don’t permanently write it off. Stay in the loop about new releases, and test your configuration with each new release. Look for ways to simplify your form configurations to make them more mobile friendly.

 

Tweet about this on TwitterShare on FacebookShare on Google+

Tip #849: Adding Security Roles to Dynamics 365 Apps

One of the great new features of Dynamics 365 is the new App Designer.  (For a video review of the App Designer, take a look at Tip #799). The App Designer allows the customization of Dynamics 365 to create targeted experiences for user navigation based on job function or system areas of importance. For example, a “Sales” app can be created which excludes standard areas not needed by a salesperson in their day, such as Service or Settings.

Custom Sales App Example

Once the app is created in Dynamics 365, you can choose to enable the app for specified security roles.

manage app rolesmanage roles 2

This security role application for the customized app experience will also extend to the tablet app as well for a streamlined tablet experience!

Tweet about this on TwitterShare on FacebookShare on Google+

Tip #848: Outlook App experience in Outlook 2013 vs Outlook 2016

When using the new Outlook app for Dynamics 365, be aware that the user experience in Outlook is different between Outlook 2013 and Outlook 2016.

In Outlook 2016, users will see a Dynamics 365 button on the menu of Outlook. After pushing the button from an email message, the app pane will open and launch within 2-3 seconds, from which users can track and set regarding on the message.

dynamicsbutton

In Outlook 2013, there is no Dynamics 365 button. Instead users must click the “Apps for Outlook” button, select the Dynamics 365 app, and then the app will launch.

lunching the app

This is something to keep in mind as you roll out the app, as your training documentation steps will need to be different if you have users on both 2013 and 2016, and may be a good reason to upgrade your 2013 users to 2016 to provide a less “clicky” experience.

Thanks to Scott Jung for this tip.

Tweet about this on TwitterShare on FacebookShare on Google+

Tip #847: Web chat is now available

Technically, it is called “Live Assist for Dynamics 365 Powered by CaféX” (hands up who prefers “Web Chat”) and is now available on AppSource.

Full details of the announcement are available. As per AppSource guidelines, there is a free trial and a video walkthrough.

This app will allow you to embed web chat operator panel within web client and Unified Service Desk. As for the client side, during the configuration process you’ll be given a script to paste into your web site (which does not have to be portal, in case anyone is wondering) and the chat widget will magically appear.

Tweet about this on TwitterShare on FacebookShare on Google+

Tip #846: Duplicate security roles in Dynamics 365

In Dynamics 365 Customer Engagement(8.2), if you change a Business Unit’s parent BU, custom security roles in the Business Unit may be duplicated.

duplicate roles

If you then change the parent BU a second time, a third copy of the roles will be created. This is a known issue. If it happens to you, open a ticket with Microsoft support, or alternatively, recreate your custom security roles.

Thanks to Eric Labashosky for bringing this to our attention.

Tweet about this on TwitterShare on FacebookShare on Google+

Tip #845: Store Dynamics 365 file attachments in Azure Blob storage

Apparently our friends at Microsoft Research have heard Neil Benson’s eloquent explanation of storage costs in Tip #553, as they have released a solution called Attachment Management in AppSource. This solution moves note and email attachments to Azure blob storage, where storage costs are cheaper than Dynamics 365 storage.

The solution includes a plugin called AzureAttachments which handles creation of the attachment in Azure when a note or email attachment is added to Dynamics 365, deletion of the file in Dynamics after the file has been created in Azure blob storage, deletion of the attachment from Azure blob storage if the corresponding note or activity are deleted from Dynamics 365, and retrieval of the attachments when the attachment is requested in Dynamics 365.

Deploying the solution requires an Azure storage account and registration of plugin steps, so be sure that you have the necessary licenses and access to the plugin registration tool.

So now that this solution is available, is there still a place for third party attachment extractor tools? The answer is yes–if you want to store attachments someplace else than Azure Blob storage (such as SharePoint), or if you have many existing attachments that you wish to move to a different location (not just new attachments going forward). Also, keep in mind that this is the first release of this solution, so there may be some rough edges.

But it is great to have a standard Microsoft option that leverages Azure Blob storage, and the solution has some nice functionality, such as an optional web resource to allow users to upload multiple attachments simultaneously.

For more information, see the Attachment Management user guide.

Tweet about this on TwitterShare on FacebookShare on Google+