Wednesday, August 2. 2006Playing with GridsThis seems to be the most popular subject available on this blog. Seems no one has tried playing with the Microsoft CRM grids as much as me, which is rather interesting
A while back I touched on how to "colourise" the grid rows, a reader comment got me thinking about how I could satisfy an internal request here. In our old system, they used a dummy entry to trigger a filter which changed the formatting to highlight it. IE they created a record of type "notice" and it would make it bold and bright purple! Couldn't miss it!
So they've asked whether it would be possible to implement something similar with CRM. As these screenshots show, it is!
Before
After
As you can see, a huge improvement, they should have no problems working out that there are no more repairs to be booked for those days
This uses the same colourising code as the previous post, with a few additions
Click on a comment to hide it. Click here to show all comments.
// if someone can work out why the computers here insist the week starts at Thursday what would beThis will take the contents of a lookup field in the grid, check its GUID against the correct one, and if it is remove all TD's from the field except for the one containing the lookup, and then expand and modify it.
Now please remember, this is a VERY BASIC example. If you modify the view at all or the view contains different fields it won't work. This goes for all grid modifying via javascript. Its also very definitely NOT SUPPORTED by Microsoft. So don't ask them.
From Steve:
Hi, I'm thinking whether we can modify the grid view such as add .gif images in the column?
I need to do that because there's a user requirement which the customer wants me to show different gif images (like traffic lights) based on the status.... Do you have any idea? Sure do Steve!
What you would do, is once you are in the loop checking each row, instead of replacing the background colour (or in addition to) you could add an image to a column, or replace the icon. To replace the icon you would be looking at something like:
grid.childNodes[i].childNodes[1].innerHTML = '<img src="http://server/your/img_here.gif" alt=""This has been tested and seems to work
As always, I hope this helps someone!
-bok
Update!
I get several requests a week for the content of statuses.aspx, and given that I don't actively work with Microsoft CRM anymore I figure it might just be easier if I post the source here. Feel free to comment if you need help, keep in mind though that I'll probably be a bit rusty by now
<%@ Page Language="c#" Debug="true"%>
Thursday, June 29. 2006Showing / Hiding Fields For User Who Created ItemRonald Lemmen has recently pulled out several stops in what was possible with CRM in his attempts to be able to show and hide fields based on the user logged in, and what roles they have.
I won't repeat his excellent work, but I will put forth an idea I had as to another possible use, one which I've had to implement here to keep up with Management's demands..
In this one, using Ronald's code to get the user id of the logged in user, we can compare it to the created by field. This of course requires that we have the created by field on the form somewhere. Then you can use the following code (the getUserId() function is from Ronald's blog) to check whether this is the user who created this object, and show/hide a section (or field or tab or whatever) based on that information.
Click on a comment to hide it. Click here to show all comments.
function getUserId()
It's a really simple idea. Can have some interesting uses, particularly if you combine it with the Security Role functions. This means you could make it so that only the person who created the item can change certain values, unless they're a high level manager.
Think about it
-bok
Wednesday, June 21. 2006"Colourising" Microsoft CRM GridsRecently I came up with a nice idea: what if we could shade the rows in grids?
I thought through it, and realised it was possible. Of course its not possible to make it automatically colourise the grid, at least not without editing the aspx pages and that would go well beyond the realms of the supported customisations.
Before we go further, please remember that this is not a supported customisation either as it involves searching/editing the html output, which Microsoft is well within its right to change at any time.
The code that does this is split into two bits. You could go ahead and add the "colourise" code to the isv.config.xml file, but i really hate editing that all the time
Like so:
<Button Title="Colourise" ToolTip="Colourise active grid view"That loads up the following script.
scripts/colourify.js
Click on a comment to hide it. Click here to show all comments.
/**
As you can see, it has limited application but can be useful for a "quick glance". Some shortcomings include not holding the colourised status through reloads, changing the grid page, resorting the grid, etc, as well as the loss of the blue "selected row", as you can see below this only comes up with a white font instead of black. This is also a basic prototype version. I'll extend it at some point in the future to be able to colourised based on owner, dates, or whatever columns are there
I suppose I should show some screenshots of what this actually does..
Before
After
Enjoy!
-bok
PS. I've had several requests for the source to statuses.aspx. If you would like to see this leave a comment and I'll be happy to email it through, not going to post it here though as my C# is very basic - I've only been coding in it for 6 weeks
Update!
I get several requests a week for the content of statuses.aspx, and given that I don't actively work with Microsoft CRM anymore I figure it might just be easier if I post the source here. Feel free to comment if you need help, keep in mind though that I'll probably be a bit rusty by now
<%@ Page Language="c#" Debug="true"%>
Tuesday, June 6. 2006Icons in MenuItemsSince the release of CRM 3.0 there has been examples of menu's in the "Action Bar" having icons next to the menu items. Such as this:
While it appears that there is no documentation (at least not in 3.0.4 of the SDK) as to being able to do this in the page's menu, it is actually possible, as this shows:
All you need to do is add the Icon attribute to your MenuItem entry in the isv.config.xml file, ie:
Click on a comment to hide it. Click here to show all comments.
<MenuItem Title="1. Check-in Computer" AccessKey="1" Icon="/icons/repairs/checkin.gif"Enjoy!
-bok
PS. Thanks must go to Ben Vollmer for the source of the icons, he has posted a list of places you can find your own icons on his blog.
Saturday, June 3. 2006Disappearing CalendarSeveral people have reported that their settings disappear when using the Outlook Client for CRM alongside the Web Client. This is a commonly known problem, and there are several solutions. There is no "correct" solution, any one could best suit your needs.
Delete the temporary files.
As reported on TIDBITS on MS CRM clearing your temporary internet files resolves this issue. This works by deleting the CRM cookie thats stored in your browser.
Use different URLs for accessing CRM.
As reported on Mid Atlantic Microsoft CRM and on the Microsoft CRM Newsgroups you simply need to set the URL to access Microsoft CRM to be different for each service necessary.
For example: Say you host your CRM service on an IIS Website using the IP Address 10.0.0.9 and you access it using http://crm/. In most cases http://crm.yourdomain.com/ should work also. Because this problem lies in the cookie Microsoft CRM uses to know which client you're using, if you specify say http://crm.yourdomain.com/ in the CRM Outlook Client, that means that the cookie will be issued with the crm.yourdomain.com domain set. If you then use http://crm/ to access the CRM Web Client, CRM won't see the first cookie as it is using "crm" as its domain setting.
Voila, fully functional clients
Hope someone will find this useful!
-bok
Tuesday, May 23. 2006List of Required FieldsRecently I had to develop an entity that called for the required fields to be spread across multiple tabs.
This caused some confusion amoungst the users initially when asked for extra data that they couldn't find.
I came up with this:
This provides an overview of the information that still needs to be entered into the forms before CRM will allow you to save it. Clicking on the field will change the focus to that field using the SetFocus() method the CRM Team built-in.
It uses JavaScript to loop through the form and pull out all required fields. To run it you simply need to call this from your onLoad form event:
ax_display_required_list();
Below is the code that does the hard work, you can either paste this into your onLoad event, or use the include function in the previous post to include it. Please be sure to have this code loaded before you call ax_display_required_list();
Click on a comment to hide it. Click here to show all comments.
function ax_display_required_list ()
Hope someone finds this useful.
-bok
PS. This above is posted AS-IS and has no warranty or guarantees attached.
Wednesday, May 17. 2006Deactivating Entities using JavascriptHowdy,
This is something that I discovered I needed for our internal customisations at the company I worked out.
I’d setup two status reason attributes (Completed and Cancelled). Neither of these were appropriate for an active entity, so they were on the Inactive ones. So I needed a way to de-activate the open item programmatically. Preferably using javascript.
Please note that the following is very much NOT SUPPORTED by Microsoft.
Click on a comment to hide it. Click here to show all comments.
crmForm.SubmitCrmForm(5, true, true, false);
This should save and de-activate the open item.
-Rob
Friday, May 5. 2006Javascript IncludesHi, for the first post I think we’ll start with something uhm, interesting.
Trying to squeeze all your javascript into the form editor box in Microsoft CRM can be a real pain in the arse. It’s a pain having to edit the script in the textarea box, or worse, copying and pasting it back and forth between something like Visual Studio.
Other solutions like Ben Vollmer’s Referencing an External Jscript from an OnLoad Event in Microsoft CRM just would not work for me.
So I went ahead and wrote my own using XML + HTTP requests.
Please note that this is very much NOT SUPPORTED by Microsoft.
Click on a comment to hide it. Click here to show all comments.
/***
This will load the javascript as a string, eval() it, and import all functions found into the current namespace. Note though that in order for it to pick up function statements the line needs to start with “function xxx”. Maybe someone can clean this up a bit.
Hope this helps someone.
-Rob
|