Search This Blog

Friday, September 15, 2017

Dynamics Portals : Add a local login control on the home page

Dynamics portals are a great solution to create portals and expose Dynamics 365 data to people not using our beloved XRM application.
 
One of our customers asked us to have a login control directly on the home page instead of having to click on “Sign In” link, then show the login page, then log… I think you got it.
 
The problem is the login page is a hidden page that cannot be customized.
So, I found a (dirty) way to handle this request.
 

First, create your own login control

In my home page template, I added two input controls and two buttons (Sign In and Lost password), like below, nothing fancy.

image

The code is the following
 
<h3>Identifiez vous</h3>
<div style="display:none;" id="loginMessage" class="alert alert-danger"></div>
<div>
<div class="form-group">
    <label for="txtLogin">Nom d'utilisateur</label>
    <input type="text" class="form-control" id="txtLogin" placeholder="tapez ici votre identifiant"/>
</div>
<div class="form-group">
    <label for="txtPassword">Mot de passe</label>
    <input type="password" class="form-control" id="txtPassword" placeholder="tapez ici votre mot de passe"/>
</div>
 <div class="form-group">
    <div >
      <button class="btn btn-primary" id="btnLogin">Se connecter</button> <button class="btn btn-default" id="btnLostPassword">Mot de passe oublié ?</button>
    </div>
</div>
</div>

THEN, ADD AN HIDDEN IFRAME WITH LOGIN PAGE

This is quite easy too. Add an iframe in the home page template with login page in it, and style it to hide it

<iframe id="loginFrame" src="/SignIn?returnUrl=%2F%3F" style="display:none;visibility:hidden;"></iframe>

THEN, DO THE MAGIC WITH A SCRIPT

What does the script? when clicking on the login button, copy login and password from your custom login control, then paste them in the login iframe, then click on the login button in the iframe.
Set a timer to check periodically if the login succeeded. How to detect that? if the Username textbox is not in the iframe anymore, then the login succeeded. So, refresh your homepage: Voila! you are connected.
If the Username textbox is still there and there is a validation summary on the page, login failed. Read the error message and display it on your home page.
 
image

Here is the script

$("#btnLogin").on("click",function(){
        var login = $("#txtLogin").val();
        var password = $("#txtPassword").val();

        $("#loginFrame").contents().find("#Username").val(login);
        $("#loginFrame").contents().find("#Password").val(password);
        $("#loginFrame").contents().find("#submit-signin-local").click();
       
        checkInterval = setInterval(function(){

            var isLogged = $("#loginFrame").contents().find("#Username").length === 0;
            var summary = $("#loginFrame").contents().find("#loginValidationSummary");

            if(isLogged){
                location.reload();
            }
            else if(summary.length === 1){
                $("#loginMessage").append(summary.text());
                $("#loginMessage").show();
                clearInterval(checkInterval);
            }            
        },1000);      
    });

Tuesday, June 13, 2017

New XrmToolBox plugin : Portal Records Mover

Hi Dynamics 365 community!

Today, I’m releasing a new plugin for XrmToolBox : Portal Records Mover

This plugin come from the need to export/import portal records that have been created/updated since a specific date.

I implemented a portal for one of my customer last year and he updated pages content and some other portal records. This portal needs new features so we added new portal records in our development organization. But it is not an option to deliver again these pages since it would overwrite customer changes. So I needed a way to deliver only specific portal records.

So, how to do it easily?

  • I cannot use Configuration Migration from CRM SDK since it would export all records for defined entities, not only the newly created or modified ones.
  • I cannot use standard export because I would need to export multiples entities and even NN relationships and manage import of multiple files.
  • I could use custom code to export/import records…

Better! I can now use an XrmToolBox plugin! The plugin allows to select portal entities and to define some options to retrieve records. Then you can be more precise by selecting only records you need. Finally, you can export the records in a file.

image

You can also import the file in a new organization

image

This is very a first shot so I hope there is no too much bugs. If so, please reports them on Github

As usual the plugin is available in the Plugins Store in XrmToolBox

Enjoy!

Wednesday, February 1, 2017

Display Performance Center in Chrome

Today, I was assigned a task to compare form load performance between available browsers for Windows (ie Chrome, FireFox, IE and Edge).

You might be aware that Dynamics CRM/365 include a performance center you can use by pressing Ctrl+Shift+Q. Once activated, it records load times and helps you understand your form load performance. More information here

This performance center is available in all browsers (at least with CRM 2016+) but the key combination closes Chrome!

A small tip then, you can create a bookmark with the following target :

javascript:Mscrm.Performance.PerformanceCenter.get_instance().TogglePerformanceResultsVisibility()

Or you can also use the Chrome extension Level Up

Wednesday, September 21, 2016

New XrmToolBox plugin : Attribute Usage Inspector

A colleague of mine recently asked if it was possible to inspect data usage to determine which attributes are useless in a CRM 2016 organization because not filled with any value. My first answer was: no. I used to know a solution named CRM Data Detective that does the same but for CRM 4 and CRM 2011 only.

Ok, I was wrong and found out that a version for CRM 2015/2016 also exists.

Anyway, the major problem with this solution is the fact that if the entity you want to inspect has more records than the AggregateQueryRecordsLimit (which is 50,000 in CRM Online and cannot be updated), then you don’t get real usage statistics.

This plugin resolves this limitation by querying actual records instead of performing aggregation query (only if aggregation query fails because of the limit). This can impact performance but if you really needs it, you get it.

You can also export the result in a raw Excel file.

Here is a screenshot

image

As usual, please use the Plugins Store in XrmToolBox to get this plugin.

Happy inspection!

Friday, June 10, 2016

Improved Iconator for XrmToolBox

Hi Dynamics CRM community! It’s been a long time since the last article on this blog!

Today, I want to share with you what’s new on Iconator plugin for XrmToolBox and where these changes come from.

Believe it or not but,  in my day to day consultant work, I’m not customizing Dynamics CRM anymore but mainly focus on development. So, working with Dynamics CRM icons was not part of my job. But lately, I had to work on a project with me and myself only, so it did require that I create entities and update their icons to have a shiny CRM application. And even if Iconator is a helpful plugin, it was not helpful enough. The major concerns were:

  • Cannot set entities color. You can do it in customizations but one by one entity.
  • Icons used in SiteMap (the 32x32 pixels white ones) don’t fit well if the white color touch icon edges. This is particularly true with icons from FlatIcon.com (which I recommend, by the way)

You know me, it couldn’t stay that way… So I updated Iconator plugins

First, I added possibility to optimize 32x32 images. To do so, click on “Optimize 32x32 Images” button. A dialog opens and shows all 32x32 images that don’t have a 2 pixel transparent border. The dialog shows how the optimized images will fit in its 32x32 canva. You can also change the background and icon color (for preview only) to see what it looks like with you own custom theme. Select images to optimize and click on “Update Icons” and Voilà!

image 

Second point, being able to change Entity color. Let’s imagine I optimized and apply the above icon to the selected entity. By clicking on “Change color” button, I can select another color for the entity, preview the change and apply it by clicking on “Apply color change” button.

image

Last point, it’s now possible to select multiple entities to update their icons and color in one single operation.

This update will be available soon in the XrmToolBox Plugins Store so keep an eye on it or follow me on Twitter (@TanguyTOUZARD) to be notified when the plugin update is available.

Thursday, April 28, 2016

Welcome to the XrmToolBox Plugins Store

Wow! It's been a long time since I did not write an article on my blog!

Today, I'm releasing the April 2016 version of XrmToolBox. This new version comes with an integrated plugins store. So, what does it mean?

It means each and every developer can share his/her XrmToolBox plugins without the need to ask me permissions or help to distribute the plugins across the world.

Here is what the Plugins Store looks like



As you can see, Jonas Rapp and Daryl Labar already shared their plugins through this new channel. To install their plugins, just select them and click on "Install selected packages" button and you are good to go!

The Plugins store is also capable to detect that a new version of an installed plugin is available and let syou update it.

The Plugins store is launched automatically after XrmToolBox startup but you can disable this in the store form itself or in XrmToolBox options. The Plugins Store is also available from the main application toolbar.

So, what do you need to do if you want to share your XrmToolBox plugin? Just follow this procedure on XrmToolBox wiki

Finally, you can download this new version on the XrmToolBox website, as usual. Or maybe you installed March version and if everything goes as expected (crossing fingers), you should be able to update your XrmToolBox application automatically thanks to the XrmToolBox auto updater released in previous version.

Friday, July 31, 2015

New XrmToolBox plugin : Chart Manager

Just this once, the August release is published in July. Indeed, I’m on holidays this evening and I want to be sure everybody has the chance to get a new release of XrmToolBox with a new plugin : Chart Manager

Chart Manager

Chart Manager is a plugin that helps you to export/import charts from/to Microsoft Dynamics CRM in bulk. It also allows to edit the XML definition of a chart directly, without the need to export/import.

ChartManager-2

XrmToolBox

The toolbox itself and some plugins have been updated to fix bugs and add enhancements. The release note is available here.

If you are already using XrmToolBox, you should have received an Update Notification. If not, just go to www.xrmtoolbox.com to download the latest version.