Tuesday, December 28, 2010

CRM 4.0 Show Associated-View in an IFRAME

This was possible and was a help to almost all the developers. But after doing this some would need to hide the buttons(Add new and Add existing buttons) from the associated view.

For this i found a nice JS which was written in the below post. This was written for hiding one particular button, but i changed it to hide both button by calling the same functions. However all credit must go to the original poster as without that i wouldn't have got the idea to do this. Thanks mate.

http://social.microsoft.com/Forums/en/crmdevelopment/thread/1e8eeb04-947f-4cea-920d-4fa1946f633d


My Changed JS Snippet....



function HideAllViewButtons(Iframe) {
Iframe.onreadystatechange = function HideTitledButtons() {
if (Iframe.readyState == 'complete') {
var iFrame = frames[window.event.srcElement.id];
var liElements = iFrame.document.getElementsByTagName('li');

for (var i = 0; i < liElements.length; i++) {
if (liElements[i].getAttribute('title').indexOf('Add existing') != -1) {
liElements[i].style.display = 'none';
}
if (liElements[i].getAttribute('title').indexOf('Add a new') != -1) {
liElements[i].style.display = 'none';
}

}
}
}
}

Tuesday, December 14, 2010

Retrieving Calendar of a Bookable Resource in Dynamics

There are occasions where we need to retrieve working days and working times of a resource in Dynamics grammatically. This is quite possible...