XrmToolBox Tool: Entity Image Updater

Around middle of last week, I published v1.0 of a new XrmToolBox tool called Entity Image updater. I created this tool so that it is easier to update the images on the crm record, if that entity has an image field.

When an entity has an image field and no image has been uploaded, it displays the default person image next to the primary name label.

BeforeImage

You can upload an image, by clicking the person image and choosing a local file.

UploadImageOnce the image is upload, the form looks much nicer IMHO.

AfterImageEven though this capability exists, not many people seem to use this because:

  1. You need source the images
  2. Manually upload them one by one OR write code to upload them based on some conditions

There are so many APIs available to retrieve this data. The most useful of these APIs for this task are

  1. Clearbit – Retrieve logo based on an organisation URL
  2. Twitter – Retrieve logo based on a Twitter handle
  3. Gravatar – Retrieve logo based on a person’s email. This works only if this person has a Gravatar profile

We can try to first source the logo/avatar from these APIs, and we fail to retrieve we can still fallback to uploading an image that is relevant. This is where I believe this tool will be useful. Here is how it looks after the tool has updated the entity images.

Entity Image Updater ScreenshotThe tool actually updates a field called “entityimage” in the entity.

EntityImageField

Installation

  1. Download the latest version of XrmToolBox.
  2. Install the tool from the XrmToolBox store. Refer http://mscrmtools.blogspot.com.au/2016/04/welcome-to-xrmtoolbox-plugins-store.html for additional details.

Using the Tool

  1. After opening the tool, click “Load Entities” to display all entities
  2. Choose an entity that has an entity image field. You’ll know that an entity has this field, if it has the person default image on the form. This is important, as I currently don’t check if the entity has this field or not. I plan to do this in the next version.
  3. Choose a source for the images. If you chose “Local Folder” you will be asked to select the folder that has the images. Please ensure that the folder has the right sized images. I plan to add resize, upload capability in the future version for “Local Folder” option
  4. Choose an attribute whose value you would use to search. For eg. if you choose “Clearbit”, select a field that has the company’s Url. This could be the file name, if you chose “Local Folder” (only png, jpg and jpeg images can be used, if you chose this option)
  5. Click on “Update All“, if you would like to lookup and update all the records for this entity
  6. If you would like to specify a criteria for update, then click the “Selective Update” field. For eg. you might want to only update records that were created by you. This will open FetchXML Builder that will help you build the conditions. Currently there is a 5-10 second delay in opening the FXB tab. I am still investigating the reason for this delay and will update the tool, once I figure out the fix. The tool will start the update process, straight after you click “Return FetchXML” in the FetchXML Builder tool

The tool will display all the images that were updated in the results window. I haven’t added the capability to save these images to disk, but I will add it in the future if that is a useful feature. I hope this tool will help all CRM folks to fully utilise the entity image field. Please feel free to use the Entity Image Uploader Issues area to log any issues that you encounter.

Thank you to

  • Guido and Adam for their feedback and suggestions
  • Tanguy for XrmToolBox
  • Daryl aka DLaB for the XrmToolBox improvements
  • Jonas for FetchXml Builder

Source code for this tool can be found at https://github.com/rajyraman/Ryr.XrmToolBox.EntityImageUpdater

Advertisements

Performing Outer Join in Advanced Find

It is currently not possible to perform left outer join using Advanced Find, even though that capability exists in CRM2015. For e.g. if you want to get a list of contacts, that don’t have an invoice, you cannot do it using an ad-hoc Advanced Find.

This limitation is usually overcome by creating a system view that does a regular inner join, and then updating the view’s fetchxml using a tool like FXB or even editing the customisation file directly. There is also the rollup field approach described in http://crmtipoftheday.com/2015/04/27/not-in-for-the-rest-of-us/. But if you are going to do an ad-hoc advanced find query, you really don’t want to create one system view for each entity, for which you want to do an outer join.

I present to you a solution for this problem: AdvancedQueryOuterJoin

This is a plugin that runs on the pre-stage of RetrieveMultiple, and alters the fetchxml with the correct left outer join condition. This means you can do an Advanced Find Query like this one below.

OuterJoin

The above query is for Account, who have child contacts, but don’t have any opportunities. When the plugin sees a link entity in the query, with a null primary key condition, it replaces that condition with a left outer join on the parent entity. The code itself is very simple, and you can have a look at the github repo to understand how this works.

You can download the solution from https://github.com/rajyraman/AdvancedQueryOuterJoin/releases. Download the solution file that works best for your CRM instance i.e. 7.0 or 7.1. Please also use the github issues area, for entering details about any problems that you encounter.

EDIT (01/06/15): Using this plugin will not correct the fetchxml you download by clicking the Download Fetch XML in the Advanced Find window. If you are going to run your downloaded query in FXB, make sure you change the Output type to Grid.

FXB

If you use FetchResult, you won’t see any results, as the plugin would not have executed in the background.

EDIT (02/10/15): Refer to the newer post https://dreamingincrm.com/2015/09/14/bookmarklet-advanced-find-outer-join-a-k-a-not-in-condition/ for doing this using bookmarklet.