Thursday, August 27, 2009

Mass Edit in CRM 4

I was fixing a bug in our CRM 4 defect list and i found that mass edit was not working properly. I checked with my logins which was the domain admin and it was working fine for me. Then i asked for the login which was giving trouble and i found that the issue reported was true. I enabled the CRM trace and found out the issue. Some permission was missing from this user role. When i checked it.(as per the http://charithr.blogspot.com/2009/08/issues-with-que-privileges-in-crm-4.html ).

I found out that this user role was missing the assign right for this entity. although the operation was happening the CRM is giving that an error which says that something has gone wrong.

Please check the assign permission when doing mass editing if it's not wokring.

Remove Existing Buttons from CRM Pages - Updates

While i have done the testing in my browser after i have done the previous post i was told by some members of the QA team that this functiolaity was not working. I checked from my Broswer and it was woring fine in my machine. Then i inquired which browser they were using as mine was IE8. They were using IE7. I checked the DIV tag returned from each section and found out that in IE 8 ID attribute is followed by the class tag, but in IE 7 it's followed by Title tag.

I changed the javascript after that to check the browser version and it worked fine for both IE 8 and 7. |I will be publishing the changed javascript shortely.

Tuesday, August 18, 2009

Remove Existing Buttons from CRM Pages

This is something that when we upgraded one of our systems from 3 to 4 identified. This was a something we wanted to hide and i wanted to get some ideas from the web regarding this.
Fortunetly for me there was very good article by Dave Hawes. http://blog.davehawes.com/post/2008/04/23/MSCRM-4-Remove-Add-Existing-xxxxx-button.aspx

I used this article to get an idea. After reading this article i was able to get a clear idea of how to do this, but i wanted a generic solution as i wanted to apply this to all the CRM forms. i have pasted below the javascript i used.



var navGroup= document.getElementById('crmNavBar');
if (navGroup != null)
{
var x= navGroup.getElementsByTagName('li');
if (x != null)
{
//First 3 links are for the same entity, activity and activty history, Hence i removed them.
for( var i = 2; i < x.length ; i++ )
{
//getting the dive area. Refer below
var Div = x[i].innerHTML;
//get the index of id
var T = Div.indexOf('id');
//get the index of class
var T2 = Div.indexOf('class');
//get the value of title
var Title = (Div.substring(T+3,T2));

if (Title.indexOf('nav_') !=-1)
{
Title = Title.substr(4,Title.length-5);
}
else if (Title.indexOf('nav') !=-1)
{
Title = Title.substr(3,Title.length-4);
}

//Sub Accounts are different when treated by this javascript
if (Title.toLowerCase() != 'subact')
{
HideAssociatedViewButtons2(Title);
}
else
{

HideAssociatedViewButtons('SubAccts', ['Add existing Member to this record']);

}

}
}
}


function HideAssociatedViewButtons2(loadAreaId)
{

var isNativeEntity = false;
var navElement = document.getElementById('nav_' + loadAreaId);

if (navElement == null) {
navElement = document.getElementById('nav' + loadAreaId);
isNativeEntity = true;
}



if (navElement != null) {
navElement.onclick = function LoadAreaOverride()
{
if (isNativeEntity)
{
loadArea('area' + loadAreaId);
HideViewButtons2(document.getElementById('area' + loadAreaId + 'Frame'));
}
else
{
loadArea(loadAreaId);
HideViewButtons2(document.getElementById(loadAreaId + 'Frame'));
}
}
}
}



function HideViewButtons2(Iframe)
{


if (Iframe != null ) {
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';
break;
}
}
}
}
}
}


function HideAssociatedViewButtons(loadAreaId, buttonTitles)
{

var navElement = document.getElementById('navSubAct');
navElement.onclick = function LoadAreaOverride()
{
loadArea('area' + loadAreaId);
HideViewButtons(document.getElementById('area' + loadAreaId + 'Frame'), ['Add existing Member to this record']);
}

}



function HideViewButtons(Iframe, buttonTitles)
{
if (Iframe != null ) {
Iframe.onreadystatechange = function HideTitledButtons() {
if (Iframe.readyState == 'complete') {
var iFrame = frames[window.event.srcElement.id];
var liElements = iFrame.document.getElementsByTagName('li');
for (var j = 0; j < buttonTitles.length; j++) {
for (var i = 0; i < liElements.length; i++) {
if (liElements[i].getAttribute('title').indexOf('Add existing') !=-1)
{
liElements[i].style.display = 'none';
liElements[i].style.visibility = 'hidden';
break;
}
}
}
}
}
}
}

DIV is similar to the below statement.

Associate Members


I would like to thank Dave and all the contributors for the their comments in the above mentioned post as without that i wouldn't be able to come up with this. Thanks mates.

Cheers.

Sunday, August 16, 2009

Permisson Issue

Earlier today i post a link for checking permissions.

Below I'm giving the link which should be referred to identify which permission is lacking for the user.

http://support.microsoft.com/kb/953962

ISV Config button enabling

In CRM3 when we wanted to enable ISV buttons all we had to do was to go to the CRM web Config and change the ISV elements value to the required value (Web). This would have displayed the ISV buttons.

But in CRM4 this is not the case. This has been taken from the web config and have embeded to the web site. I have given below a link which helped me to find this.

http://blogs.msdn.com/jannemattila/archive/2008/01/10/crm-4-0-and-isv-config-modifications.aspx

Thanks for the helpful link.