I had a client recently go through and clean up the Roles of CRM because they were creating so many new roles that the list as getting a little unwieldy. I always recommend that the system roles should be left in tact and untouched so that they can be used as templates to copy new roles from. Well, sometimes curiosity gets the best of us and I recently found out what happens when you delete system roles.
At first you notice no difference. Records still stay in tact, can be viewed, updated, deleted, etc with no problem. However if you try to create a custom entity and the "System Customizer" role is gone (this also goes for the "System Administrator" role but Microsoft has locked down the deletion of that role) then CRM will throw an error at you telling you to contact your system administrator. A great error message that gets you no closer to figuring out your problem.
After a bit of searching I found the following:
Microsoft KB article 934690:
When a custom entity is created, Microsoft Dynamics CRM automatically grants the System Customizer role access to the new entity. If you delete or edit the System Customizer role, you receive the error message that is mentioned in the "Symptoms" section.
Microsoft has a hotfix for this issue (because apparently I wasn't the only curious one out there) but you have to contact MS Support in order to obtain the hotfix. From my other searchings, your other option is to back up CRM, uninstall CRM, install CRM fresh and then migrate all of your data from the back up into the new system. If you restore your DB's then you will once again be missing the "System Customizer" role so that will get you nowhere.
Oh, and in case you're wondering, you can't just recreate a "System Customizer" role manually. I tried to copy the "System Administrator" role, name it "System Customizer" and then tried to create a custom entity. I got the same error as I had received before. Whatever script Microsoft has running in the background looks for the GUID of the "System Customizer" role instead of the name. So, while I thought I had a nice quick fix it tuned out to not do anything at all.
So, this is my warning to all of you, DON'T DELETE ANY OF THE OUT-OF-THE-BOX ROLES. I don't know of any other issues with any of the other roles yet but that doesn't mean that there aren't any other similar issues like this. It doesn't cost anything to just leave the system roles there and let them be but it will cost you a bit of grief to get them back and get your system back up to full running capabilities.
Hope this helps someone and kills your curiosity on this subject.
David Fronk
Dynamic Methods Inc.
Friday, September 21, 2007
Friday, September 14, 2007
Set Regarding Lookup Default Entity
I've had numerous customers request, that in order to help their best practices, that the default object on the Regarding field default to the entity users should be associating activities. Some clients want it to default to Contact, others to Opportunities, and some to custom objects. I could never figure out how to get control of the window or form assistant where the entity dropdown list is made available. However, one of my co-workers found that we don't need control of the window, we can set the default attribute with a bit of JScript.
On the OnLoad event of the activity (theoretically this should work for whatever lookup you want, i.e. the Customer field on Case and Opportunity) place the following script:
if (crmForm.all.regardingobjectid != null) {
crmForm.all.regardingobjectid.setAttribute("defaulttype", "2");
}
This code will set the default entity to be Contact. If you want a custom object they start at 10000. So, just fine the ObjectTypeCode of the entity you want (that can have activities associated to them) and place them in the quotes as the second parameter of the setAttribute method and you're set.
Please note that this only effects the window that gets opened when you click on the magnifying glass of the Regarding field. However it does not effect the Form Assistant. So, this doesn't do it all, but it does help in some regard.
Also, please note that this customization is not supported by the SDK and may be subject to change in the next version. But while this is a "lighter" unsupported customization it's the kind of customization that I like. No files get modified, upgrade path does not get hindered, you just have to check it after the upgrade to make sure it works. If it doesn't, you have to find the new method or call that is used to do what we just did.
Short, simple and sweet. Happy coding!
David Fronk
Dynamic Methods Inc.
On the OnLoad event of the activity (theoretically this should work for whatever lookup you want, i.e. the Customer field on Case and Opportunity) place the following script:
if (crmForm.all.regardingobjectid != null) {
crmForm.all.regardingobjectid.setAttribute("defaulttype", "2");
}
This code will set the default entity to be Contact. If you want a custom object they start at 10000. So, just fine the ObjectTypeCode of the entity you want (that can have activities associated to them) and place them in the quotes as the second parameter of the setAttribute method and you're set.
Please note that this only effects the window that gets opened when you click on the magnifying glass of the Regarding field. However it does not effect the Form Assistant. So, this doesn't do it all, but it does help in some regard.
Also, please note that this customization is not supported by the SDK and may be subject to change in the next version. But while this is a "lighter" unsupported customization it's the kind of customization that I like. No files get modified, upgrade path does not get hindered, you just have to check it after the upgrade to make sure it works. If it doesn't, you have to find the new method or call that is used to do what we just did.
Short, simple and sweet. Happy coding!
David Fronk
Dynamic Methods Inc.
Friday, September 07, 2007
Moving SMTP from Exchange to local CRM SMTP Server
Here's the situation:
CRM has already been installed and pointed to an Exchanged server. The client requested that SMTP be set up on CRM and used for sending outbound emails. No inbound functionality is required by the client. What is the best way to get CRM outbound emails to be sent directly from the CRM SMTP server?
Solution:
First, make sure SMTP is installed on the CRM server. If not, you will need to add it under Add/Remove Programs, Windows Components, Application Server, Details, IIS, Details, select SMTP Service and install. It will ask for the Server 2003 install disk.
If after installation of the SMTP service you can not see the 'Default SMTP Virtaul Server' in IIS, you will need to follow the directions below from microsoft:
Method 1: Click the 'Start' button, then 'Run…' and type:
regsvr32 %systemroot%\system32\inetsrv\smtpsnap.dll
Alternatively, %systemroot% can be replaced with the drive Windows Server 2003 is installed on
Method 2: Uninstalling and re-installing IIS including the SMTP service has also proven to fix the problem, it is, however, recommended to try method 1 first.
Once you have SMTP fully installed and configured (per the steps above) you will now need to remove 4 keys from the MSCRM reg hive. Type regedit from cmd line. Browse to the HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSCRM folder. Highlight the folder and right click. Then select Export - give it a name and save. This is a back up of the MSCRM reg folder in case you mess up.
After backing up the folder, proceed to remove 4 keys:
1. SMTPAuthenticate REG_DWORD Value=0
2. SMTPServer REG_SZ Value=ExchangeServerName
3. SMTPServerPort REG_DWORD Value=19
4. SMTPUseSSL REG_DWORD Value=0
Perform an iisreset and test email functionality directly from CRM.
If you did not set everything up correctly you will most likely see an error to the effect of:
'Failed to Initialze Token'
If that be the case, go back through the steps and double check that they were all input correctly. But the above steps should get it going for you.
My thanks to my CRM team for providing me with another great article.
David Fronk
Dynamic Methods Inc.
CRM has already been installed and pointed to an Exchanged server. The client requested that SMTP be set up on CRM and used for sending outbound emails. No inbound functionality is required by the client. What is the best way to get CRM outbound emails to be sent directly from the CRM SMTP server?
Solution:
First, make sure SMTP is installed on the CRM server. If not, you will need to add it under Add/Remove Programs, Windows Components, Application Server, Details, IIS, Details, select SMTP Service and install. It will ask for the Server 2003 install disk.
If after installation of the SMTP service you can not see the 'Default SMTP Virtaul Server' in IIS, you will need to follow the directions below from microsoft:
Method 1: Click the 'Start' button, then 'Run…' and type:
regsvr32 %systemroot%\system32\inetsrv\smtpsnap.dll
Alternatively, %systemroot% can be replaced with the drive Windows Server 2003 is installed on
Method 2: Uninstalling and re-installing IIS including the SMTP service has also proven to fix the problem, it is, however, recommended to try method 1 first.
Once you have SMTP fully installed and configured (per the steps above) you will now need to remove 4 keys from the MSCRM reg hive. Type regedit from cmd line. Browse to the HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSCRM folder. Highlight the folder and right click. Then select Export - give it a name and save. This is a back up of the MSCRM reg folder in case you mess up.
After backing up the folder, proceed to remove 4 keys:
1. SMTPAuthenticate REG_DWORD Value=0
2. SMTPServer REG_SZ Value=ExchangeServerName
3. SMTPServerPort REG_DWORD Value=19
4. SMTPUseSSL REG_DWORD Value=0
Perform an iisreset and test email functionality directly from CRM.
If you did not set everything up correctly you will most likely see an error to the effect of:
'Failed to Initialze Token'
If that be the case, go back through the steps and double check that they were all input correctly. But the above steps should get it going for you.
My thanks to my CRM team for providing me with another great article.
David Fronk
Dynamic Methods Inc.
Saturday, September 01, 2007
How to Really Increase the Max File Size in MSCRM (v3.0)
This comes from one of my co-workers:
Step 1:
In the Web.config file, override the value of maxRequestLength for the application. For example, the following entry in Web.config allows files that are less than or equal to 8 megabytes (MB) to be uploaded:
<httpRuntime maxRequestLength="8192" />
Real Example: <httpRuntime executionTimeout="3000" maxRequestLength="51000"/>
Comments: I increase the Timeout from 300 to 3000 to allow more time on the upload. The file size is set to max at 51 MB.
Step 2:
(**Be careful when making changes to the Registry, it's always safer to back up the Registry, or at least the hive you're changing, just in case something breaks.**)
Change the following registry key to reflect the maximum number of bytes in decimal:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSCRM\maxuploadfilesize
Real Example: Make sure you set the Decimal value to the number of bytes. So 50 MB converts to 52428800 bytes, or I put 53000000.
Step 3:
Reset Internet Information Services (IIS). To do this, click Start, click Run, type iisreset, and then click OK.
Real Example: CMD --> IISRESET
Hope this comes in handy.
David Fronk
Dynamic Methods
Step 1:
In the Web.config file, override the value of maxRequestLength for the application. For example, the following entry in Web.config allows files that are less than or equal to 8 megabytes (MB) to be uploaded:
<httpRuntime maxRequestLength="8192" />
Real Example: <httpRuntime executionTimeout="3000" maxRequestLength="51000"/>
Comments: I increase the Timeout from 300 to 3000 to allow more time on the upload. The file size is set to max at 51 MB.
Step 2:
(**Be careful when making changes to the Registry, it's always safer to back up the Registry, or at least the hive you're changing, just in case something breaks.**)
Change the following registry key to reflect the maximum number of bytes in decimal:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSCRM\maxuploadfilesize
Real Example: Make sure you set the Decimal value to the number of bytes. So 50 MB converts to 52428800 bytes, or I put 53000000.
Step 3:
Reset Internet Information Services (IIS). To do this, click Start, click Run, type iisreset, and then click OK.
Real Example: CMD --> IISRESET
Hope this comes in handy.
David Fronk
Dynamic Methods
Tuesday, July 31, 2007
Pulling the Logged in User via JavaScript
I have been trying to find a good way to make "signatures" work in CRM. Some way for a manager to fill in a field for approval and then automatically put in the name of the manager into a field to prove that it was done by that person. I had found a way through some disabling the field and only opening it for users with a specific security role, but that still relied on the honesty of the managers. Some clients don't always trust their managers 100% unfortunately.
I have since found a post that gave me exactly what I was looking for. JavaScript that reads in the logged in user and puts the name of the logged in user into a text field automatically. So, whenever a specific field gets updated the user who changed it will get his/her name printed out so that all can see that the field was changed/approved by that user. Couple that with some additional JavaScript field level security and you've got a pretty good signature system. (Note that the field level security is NOT supported by Microsoft).
The cool part about finding the logged on user though is that it is supported JavaScript and uses the RetrieveMultiple CRM call to pull back the information desired. I take absolutely no credit for this code. I didn't have to really even change anything other than the output of the name so that it went into a field instead of an alert window. All credit goes to Michael Höhne, Microsoft Dynamics CRM MVP at Stunware. Here is the link to his post:
http://www.stunnware.com/crm2/topic.aspx?id=JSWebService
I have since found a post that gave me exactly what I was looking for. JavaScript that reads in the logged in user and puts the name of the logged in user into a text field automatically. So, whenever a specific field gets updated the user who changed it will get his/her name printed out so that all can see that the field was changed/approved by that user. Couple that with some additional JavaScript field level security and you've got a pretty good signature system. (Note that the field level security is NOT supported by Microsoft).
The cool part about finding the logged on user though is that it is supported JavaScript and uses the RetrieveMultiple CRM call to pull back the information desired. I take absolutely no credit for this code. I didn't have to really even change anything other than the output of the name so that it went into a field instead of an alert window. All credit goes to Michael Höhne, Microsoft Dynamics CRM MVP at Stunware. Here is the link to his post:
http://www.stunnware.com/crm2/topic.aspx?id=JSWebService
The code from his post is this:
var xml = "" + "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
"<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">" +
" <soap:Body>" +
" <query xmlns:q1=\"http://schemas.microsoft.com/crm/2006/Query\" xsi:type=\"q1:QueryExpression\" xmlns=\"http://schemas.microsoft.com/crm/2006/WebServices\">" +
" <q1:EntityName>systemuser</q1:EntityName>" +
" <q1:ColumnSet xsi:type=\"q1:ColumnSet\">" +
" <q1:Attributes>" +
" <q1:Attribute>systemuserid</q1:Attribute>" +
" <q1:Attribute>fullname</q1:Attribute>" +
" </q1:Attributes>" +
" </q1:ColumnSet>" +
" <q1:Distinct>false</q1:Distinct>" +
" <q1:Criteria>" +
" <q1:FilterOperator>And</q1:FilterOperator>" +
" <q1:Conditions>" +
" <q1:Condition>" +
" <q1:AttributeName>systemuserid</q1:AttributeName>" +
" <q1:Operator>EqualUserId</q1:Operator>" +
" </q1:Condition>" +
" </q1:Conditions>" +
" </q1:Criteria>" +
" </query>" +
" </soap:Body>" +
"</soap:Envelope>" + "";
var xmlHttpRequest = new ActiveXObject("Msxml2.XMLHTTP");
xmlHttpRequest.Open("POST", "/mscrmservices/2006/CrmService.asmx", false);
xmlHttpRequest.Open("POST", "/mscrmservices/2006/CrmService.asmx", false);
xmlHttpRequest.setRequestHeader("SOAPAction","http://schemas.microsoft.com/crm/2006/WebServices/RetrieveMultiple");
xmlHttpRequest.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
xmlHttpRequest.setRequestHeader("Content-Length", xml.length); xmlHttpRequest.send(xml);
var doc = xmlHttpRequest.responseXML; var user = doc.selectSingleNode("//BusinessEntity");
var doc = xmlHttpRequest.responseXML; var user = doc.selectSingleNode("//BusinessEntity");
var userId = user.selectSingleNode("systemuserid").text;
alert(userId);
var userName = user.selectSingleNode("fullname").text;
alert(userName);
You can quite literally copy and paste the code into any JavaScript function inside of CRM and this will work. There is nothing that ties it to one CRM implementation or another.
My hat goes off the Michael and the rest of the Stunware team for their great work and sharing this spectactular code. Thanks guys.
Happy coding,
David Fronk
Dynamic Methods Inc.
Monday, July 30, 2007
EmailTo via JScript
One of the shortcomings that I've found with some of the out-of-the-box features in MSCRM is the Email field. It's underlined, so it is supposed to be a link but when you click on it, instead of opening an email page like a URL does for a web page, it does nothing.
I finally decided to spend some time on figuring out some way around the "copy/paste" method that I have told so many users previously to do to work around this issue. And while I did not solve the onClick problem I did at least find a way to get an email page to come up with the email from the email field filled in. A huge win over the "copy/paste" method.
I found a way through JScript in the ISV.config to get everything I needed. I knew that I could use the "mailto:" call from the HREF HTML tags but I wasn't sure on how to reference it. So, after a little research I found a pretty cool way to get around this problem. So, I cannot by any means take full credit for figuring this out, I can only claim credit for finding the pieces necessary and putting them together to get what I needed done (as I'm sure most of us do through the wonderful knowledge share called the Internet). So, thanks to anyone any everyone who has posted about this, I probably saw your posts and they have contributed to this:
<button title="Email" tooltip="Send Email" icon="/_imgs/ico/16_send.gif" javascript="window.navigate('mailto:'+crmForm.all.new_email.DataValue)" passparams="0" winparams="" winmode="0">
The key is the JavaScript attribute and the window.navigate call. Once the window.navigate reference was made it was also very great to see I could call any field value on the form to my JavaScript stored in the ISV.config. That ability alone opens up a lot of doors to new possibilities. It makes sense that all of the supported hooks that we as developers are given are JavaScript that we could use the exact same calls from a different source, it just wasn't something I had tried until now. Once I had those points down it was a piece of cake.
So, now I have a button along the toolbar that will open up your default email client to whatever email address you specify. I'm sure there are some much more complex scripts that can come from this (like a primary email selection box that then pics the corresponding email address to send the email to).
Happy coding,
David Fronk
Dynamic Methods Inc.
I finally decided to spend some time on figuring out some way around the "copy/paste" method that I have told so many users previously to do to work around this issue. And while I did not solve the onClick problem I did at least find a way to get an email page to come up with the email from the email field filled in. A huge win over the "copy/paste" method.
I found a way through JScript in the ISV.config to get everything I needed. I knew that I could use the "mailto:" call from the HREF HTML tags but I wasn't sure on how to reference it. So, after a little research I found a pretty cool way to get around this problem. So, I cannot by any means take full credit for figuring this out, I can only claim credit for finding the pieces necessary and putting them together to get what I needed done (as I'm sure most of us do through the wonderful knowledge share called the Internet). So, thanks to anyone any everyone who has posted about this, I probably saw your posts and they have contributed to this:
<button title="Email" tooltip="Send Email" icon="/_imgs/ico/16_send.gif" javascript="window.navigate('mailto:'+crmForm.all.new_email.DataValue)" passparams="0" winparams="" winmode="0">
The key is the JavaScript attribute and the window.navigate call. Once the window.navigate reference was made it was also very great to see I could call any field value on the form to my JavaScript stored in the ISV.config. That ability alone opens up a lot of doors to new possibilities. It makes sense that all of the supported hooks that we as developers are given are JavaScript that we could use the exact same calls from a different source, it just wasn't something I had tried until now. Once I had those points down it was a piece of cake.
So, now I have a button along the toolbar that will open up your default email client to whatever email address you specify. I'm sure there are some much more complex scripts that can come from this (like a primary email selection box that then pics the corresponding email address to send the email to).
Happy coding,
David Fronk
Dynamic Methods Inc.
Tuesday, June 26, 2007
Changing the Port Number of your CRM Website
One might think that changing the port number which CRM uses is pretty straight forward but I found that it wasn't quite as simple as I thought. I ran into this in order to get CRM and SharePoint to play nice together on a server which already had CRM installed and I needed to install SharePoint on the same server.
The first thing that I did was go into the IIS Management Console and manually change the port number there. I found out that was only half the problem. From here, once this change is made one could run a repair and that should make all of the necessary changes to the CRM web site for you from there. However, if you have installed Rollup1, or any other patches for that matter, you would then have to reinstall everyone of those patches. Not the most effective use of time in my opinion.
So, after poking around a bit I found that the other piece that I needed to update was the URL registry key titled "ServerURL" under the "HKey_LOCAL_MACHINE\SOFTWARE\Microsoft\MSCRM" hive. You simply need only to add the colon ":" and the port number and you're set. So, your URL would go from "http:///MSCRMServices " to "http:///MSCRMServices:5555 " and you're set. Quick, efficient and it works.
David Fronk
Dynamic Methods Inc.
The first thing that I did was go into the IIS Management Console and manually change the port number there. I found out that was only half the problem. From here, once this change is made one could run a repair and that should make all of the necessary changes to the CRM web site for you from there. However, if you have installed Rollup1, or any other patches for that matter, you would then have to reinstall everyone of those patches. Not the most effective use of time in my opinion.
So, after poking around a bit I found that the other piece that I needed to update was the URL registry key titled "ServerURL" under the "HKey_LOCAL_MACHINE\SOFTWARE\Microsoft\MSCRM" hive. You simply need only to add the colon ":" and the port number and you're set. So, your URL would go from "http://
David Fronk
Dynamic Methods Inc.
Subscribe to:
Posts (Atom)