Posts

Showing posts with the label javascript

New XrmToolBox plugin! Form Libraries Manager

Image
Last month, I had to work on some JavaScript web resources cleaning and I wanted to rename all my web resources. This is not so complicated when using the Web Resources Manager plugin to drag and drop JavaScript files to some new folders. The difficult part was to update all forms that used some shared web resources like JSON2, jQuery and XrmServiceToolkit. So, I decided to write… a plugin for the XrmToolBox. So, let me introduce the Form Libraries Manager This plugin can list all JavaScript web resources and all forms (only active forms for CRM 2013). You can select web resources to add and forms where to add them. If multiple web resources are selected, you can order them and choose where to display them : at the beginning of the scripts list for forms or at the end. I’m sure this will help people to initialize all their forms with required web resources. It can also remove in bulk selected libraries. For each selected library, if it is used by a form event, a warning is display...

Did you notice the script finder?

Image
Maybe you noticed there was a new tool in the toolbox. It’s a really simple one that displays all scripts referenced on all entities accross an organization. It is really useful when you arrive on a project without knowing what was really done on forms. I will maybe add an export feature as I’m quite sure someone will ask for it. Just an extra information: thanks to the toolbox, it took me only 30 minutes to develop this tool!

CRM 2011 Ribbon: Using other controls than just Group and Button : ColorPicker!

Image
Hi, As you might know, I developed some tools for ribbon usage (even if some of them are not really usable right now). Yesterday, I tried to use a ColorPicker control to check the behavior of my ribbon editor and found some inconstancy in the SDK. Anyway, I wanted to try a ColorPicker control and try it in real life scenario (or something useful for your/my customers). Here is the scenario: I want to be able to flag an account with a color (just like Outlook categories for email, appointment, etc.). For this, I will add a color picker on the ribbon and update the color of the form header (thanks to customer effective for this part: Changing the form header and footer colors ). The final look I expect: What I need: A solution with an image for my button, a script for changing header color, jQuery library to ease the write of scripts. The entity account is here since I apply the ColorPicker to this entity. Script content: function ApplyColorToHeader(commandProperties) { va...

CRM 2011: Overriding lookup onclick event

I know that some of you can’t wait to know how to override lookup control onclick event. Indeed, Microsoft has heavily used htc file for their controls behavior and it’s more difficult to change these behaviors than it was in Dynamics CRM 4.0… So, here is the solution: var element = document.getElementById( "lookup_attribute_logicalname" ); element.onshowdialog = function ( event ) { var url = "http://you_custom_page_url" ; var result = window.showModalDialog(url); event .oLookupItems = { items: result }; }; The object returned from the page should be an array of Lookup items, like the following (example for an account): var lookupItems = new Array(); lookupItems[0] = new Object(); lookupItems[0].id = "{...}" lookupItems[0].name = "My account" ; lookupItems[0].type = 1; lookupItems[0].entityType = "account" ; window.returnValue = lookupItems; To be honest, I’m not the one who found this solution. All the cr...

New tool: JavaScript Web Resource Manager for Microsoft Dynamics CRM 2011

Image
I didn’t find a way to provide you a JavaScript editor as flexible as the one I created for Microsoft Dynamics CRM 4.0 since the scripts are now in two parts in Microsoft Dynamics CRM 2011: web resource and script call from forms… Anyway, this new tool allows you to update JavaScript web resources with the following features: Export scripts web resources from CRM server Save scripts web resources to disk Load scripts files from disk Edit scripts with default text editor or Visual Studio Edit web resource properties Save scripts to CRM server Publish scripts to CRM server It should help you avoid multiple clicks as soon as you want to update a JavaScript web resource… As usual with my tools for CRM 2011, it is published on codeplex Just a small reminder : a Paypal donation button is just on the right part of this blog   But it’s up to you… Screenshot

CRM 4.0: Overriding lookup onclick

Image
For one of my customer, I faced a difficulty. I wanted to override the lookup onclick event to provide my own lookup selection that uses a treeview (see below picture) which is much mor euser friendly when we talk about self related entities. The problem : the behavior of the lookup is controled by a .htc file. It is a bad idea to change this kind of file (unsupported) and you can’t just remove the link to this file in the css class because you will loose all behaviors, not just onclick one. The only way I found was to create a new lookup image with its own behavior, hide the original one, and add the new image next to the original one. All this using javascript. It is also unsupported but you are sure that your javascript won’t be override during rollup installation or other kind of CRM updates. Here is the javascript: 1: var lookupAttribute = "new_categoryid" ; 2:   3: crmForm.performNewClick = function () 4: { 5: // Put here your alternative...

Tool update: Form Javascript Manager

Today, a small update on this tool. Scott Sewell told me that some characters were not escaped correctly when exporting scripts from the CRM server. It is true but as you might know I’m French so I work mainly with French environments and this problem was not showing on French CRM servers… Anyway, the bug is corrected and you can download the latest version, as usual, on the right pane of this blog.

Update: Isv Configuration Manager

Image
Hi, Today, one bug fix and one enhancement for this tool 1) A guy named Christoph has informed me that the attributes ValidForCreate and ValidForUpdate (in Button and MenuItem) are not set to “0” when you don’t action them. It is now corrected. 2) For the enhancement, it is just about Javascript boxes. I had to put heavy Javascript recently in buttons and menu items and I found that too boring not being able to select all existing script and delete it or even edit it in a wider window. So, I have added two buttons near Javascript textboxes: One for clearing the textbox content One to open a sizable edit dialog window The two new buttons The edit dialog window As usual, use the download link to get the latest version

Add an information message in CRM form

Image
With the following script, you can add an information message to a CRM form var newcontent = document.createElement("div"); newcontent.id = "message"; newcontent.style.border = "solid 1px black"; newcontent.style.marginLeft = "10px"; newcontent.style.marginRight = "10px"; newcontent.style.marginTop = "0px"; newcontent.style.marginBottom = "4px"; newcontent.innerHTML = "<table border="'0'" cellspacing="'0'" cellpadding="'4'"><tr><td style='width:20px;background-color:#FFFFAE'><img src="'/ico/16_info.gif'/" /></td><td style='font-family:Tahoma;font-size:11px;padding-left:8px;background-color:#FFFFAE;width:100%'>This is an information message.</td></tr></table>"; var scr = document.getElementById(elementId); scr.insertBefore(newcontent, scr.firstChild); Juste replace ele...