tag:blogger.com,1999:blog-316673312024-03-06T05:38:44.260+08:00Microsoft CRM HacksFirst of all, the primary objective of this blog is for my own reference, as I am a very forgetful person, so, I need a way to document all findings, tips and tricks somewhere, which allows me access anytime anywhere.
If you find any stuff here useful, you can go ahead and utilize it, and you are welcome to post your ideas and suggestions, I will be well appreciated them.
But I will not answer to any queries regarding further elaboration on the topic I documented here.Unknownnoreply@blogger.comBlogger20125tag:blogger.com,1999:blog-31667331.post-33844407063011694312009-01-30T17:06:00.000+08:002009-03-17T16:26:32.720+08:00MSCRM4 Email: Receiving Emails from Gmail POP3Requirements:
<blockquote>
• A Gmail Account<br>
• MSCRM 4 Email Router Service<br>
• MSCRM 4 Email Router Configuration Manager</blockquote>
1. Launch MSCRM 4 Email Router Configuration Manager. Under the Configuration Profile Tab, click the New button on the right.<br><br>
<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjXbnfPCq4ykMvghK_u3Sc_GdaZEb9LOm1u1Waea7yy_XeLiOtQ4NPSfdoHOc6359NSzeR3HItc7Ivws9T_jPRUntMOD3SYPDxScybDoyCiNrfsITswTKvVWlsiJQBjj_ibjosw/s1600-h/001.jpg" target="_new"><img style="cursor:pointer; cursor:hand;" src="http://i284.photobucket.com/albums/ll8/wcngai/CRMhacks/001s-3.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5308514649285813938" /></a><br><br>
2. Enter following information on the Email Router Configuration Profile dialog, General Tab:<br><br>
<pre><code>
Profile Name: <A Given Name to the Profile> (e.g. Gmail POP3)
Direction: Incoming
Email Server Type: POP3
Authentication Type: Clear Text
Server: pop.gmail.com
Use SSL: Checked
Access Credentials: User Specified (the user will required to provide their POP3
User Id and Password)</code></pre><br><br>
3. Click on the Advanced Tab, make sure Network Port is 995:<br><br>
<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhHxoq9WPuBqQcUp-PBEpMUJe7-tguLVuN61zGfUh3sZWC4DRyBgBH-TSMG2SU58gq_6oxjbBSH0aSGwYFTGGABlDF1Wz5TwQSh6QBdWTAxOCr1RVwm3ZPSsr6dAbPa7JJ2ASDH/s1600-h/002.JPG" target="_new"><img style="cursor:pointer; cursor:hand;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhHxoq9WPuBqQcUp-PBEpMUJe7-tguLVuN61zGfUh3sZWC4DRyBgBH-TSMG2SU58gq_6oxjbBSH0aSGwYFTGGABlDF1Wz5TwQSh6QBdWTAxOCr1RVwm3ZPSsr6dAbPa7JJ2ASDH/s1600/002.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5308515718705168978" /></a><br><br>
4. Click OK button to return to the Email Router Configuration Manager:<br><br>
<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjozi-wQiIA4KE9jzhVHrjd3j7EcBrGjWCs8XAkF-gwQPXgy9u7NX-AuQe9btXzM8FOl7SHgmLRf8saCnVRR2u3H9D_F9dnOzkMUEy8pDMPybxmtQV8Cpi_inFClk_TaWel7mh0/s1600-h/003.jpg" target="_new"><img style="cursor:pointer; cursor:hand;" src="http://i284.photobucket.com/albums/ll8/wcngai/CRMhacks/003s-2.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5308516828687176674" /></a><br><br>
5. Click on the Deployments Tab, and click the New button at the right:<br><br>
<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhp5gy1twiogbUCHqSDEto19uavlvDMqUXBpyPYjgL5Bd1Yl1LylO9jTUL87CsxGPaNfgusrlaEmMRQ2PxqlKtuWhe7r6ImASkbqsGsEx39l_J7yXGRfmywWNS3ZxVv9y_JLUk4/s1600-h/004.jpg" target="_new"><img style="cursor:pointer; cursor:hand;" src="http://i284.photobucket.com/albums/ll8/wcngai/CRMhacks/004s-1.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5308517492715041714" /></a><br><br>
6. At the Deployment dialog, enter information below:<br><br>
<pre><code>
Deployment: My Company
Microsoft Dynamics CRM Server: http://<SERVER_URL>/<Organization Name> (e.g. http://AT71/Fish - Case Sensitive)
Access Credentials:
Local System Account - the Computer that hosting the Email Router Service must be added to the PrivUserGroup
Other Specified: can be a domain account that has been added to the PrivUserGroup
Default Incoming Configuration Profile: Optional
Default Outgoing Configuration Profile: Optional</code></pre><br><br>
7. Click OK button to return to the Email Router Configuration Manager:<br><br>
<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi5cfi7iJ2cm5aF4Yn-c7G9oJg9hjbLMHhlwi85fQALpBOd_4ybI40mJpzq7b3VI66tqmhC3dltsC2PkL61PRPdhlVnXuwjDEqRDEy5p8szQ09meXIZh9mBgajFGmcA_B9EWJd6/s1600-h/005.jpg" target="_new"><img style="cursor:pointer; cursor:hand;" src="http://i284.photobucket.com/albums/ll8/wcngai/CRMhacks/005s-2.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5308542122877205490" /></a><br><br>
8. In order to receive emails via the MSCRM Email Router, the "E-Mail Router" option must be selected under E-mail access type - Incoming, for each user: <br><br>
<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZnHRBjvaGtMIfHQNVOvoiRxZj5OBlLz_zt79SBRSdD5P-48s04BadvlnZkSr0cNYAnpFcOGb0HRe5FRPu1x5PpQipaspcRbIkviJ4vLlxeFDhuWIX0rH7OJ2OBwebFOlqh1pc/s1600-h/006.jpg" target="_new"><img style="cursor:pointer; cursor:hand;" src="http://i284.photobucket.com/albums/ll8/wcngai/CRMhacks/006s-2.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5308542955744863138" /></a><br><br>
9. Before the user can receive incoming email, the email credentials must be configured. The user must logon to MSCRM, at the Main Menu Bar, click Tools, Options..., under the Email Tab, make sure the "Allow E-mail Router to use my credentials to send and receive e-mail on my behalf" has been checked. Provide the User Name and Password (the Gmail User Id and Password), and press the OK button to apply the changes:<br><br>
<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhXi2jJWgPm54ey0MFvF_KN902_qNr29EkXdCgT9tiuFClEQ12kfisIA1ZhVbf_Yd3OkDrNlwjo4EC7P3sVG-W3cqoZLPSSpBURXSmUEo34IvbwI6hls92tL6nlriKoBIR6Xcl9/s1600-h/007.JPG" target="_new"><img style="cursor:pointer; cursor:hand;" src="http://i284.photobucket.com/albums/ll8/wcngai/CRMhacks/007s-1.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5308543563670136898" /></a><br><br>
10. Go back to the Email Router Configuration Manager, click on "Users, Queues, and Forward Mailboxes" Tab. Select the appropriate MSCRM instance, and click on the "Load Data" button, a list of users which has been configured to send or receive email via Email Router will be shown, select the relevant user and click on the Modify button:<br><br>
<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjy51d9wEmeHesLkszJ2jUAvnjXzsZaGY6uvCDKOVp1kCt2loGheYdr0OLYnXKiqs7_cPRsoIdEJx5tfv8AogQh-7l_XhOtcGmhn5OuErtPWAvJWwDDGRQOi_axzyTjW-1Qu-W5/s1600-h/008.jpg" target="_new"><img style="cursor:pointer; cursor:hand;" src="http://i284.photobucket.com/albums/ll8/wcngai/CRMhacks/008s.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5308545552608666402" /></a><br><br>
11. Select the Incoming Configuration Profile which has been configured earlier (e.g. Gmail POP3), and click the OK button:<br><br>
<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhyDxeyq3N6TOGprixzaB2VM34gPky-9Qfri4c91GZmwptEtowsHGdKrX3k00gL5rE4TESGfZ2r4KTuzHGpVTTuVWLyApQcbfdPBTpbI0mGeooLBqSJakRhUNHOSqFv74V6Ovx9/s1600-h/009.JPG" target="_new"><img style="cursor:pointer; cursor:hand;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhyDxeyq3N6TOGprixzaB2VM34gPky-9Qfri4c91GZmwptEtowsHGdKrX3k00gL5rE4TESGfZ2r4KTuzHGpVTTuVWLyApQcbfdPBTpbI0mGeooLBqSJakRhUNHOSqFv74V6Ovx9/s1600/009.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5308546675798604562" /></a><br><br>
12. Click on the "Test Account" button to verify the configurations:<br><br>
<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYRcGFrgT6iGQVUo0qm9PU7tOUG37Ve8-qbrsiaJaZPvPhxOe3MadaFnYkAnX8gv3OQG2YhJ9pUtfKHveoEA07J0-go2a49FVWbTF2Y7MXGvs_C9lJUWZiDHkJeAp2Ba-KlWwK/s1600-h/010.jpg" target="_new"><img style="cursor:pointer; cursor:hand;" src="http://i284.photobucket.com/albums/ll8/wcngai/CRMhacks/010s.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5308547057844180946" /></a><br><br>
13. Click the Publish button to apply the changes.<br><br>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-31667331.post-52981213568157783702009-01-18T09:37:00.015+08:002009-03-02T16:03:29.074+08:00MSCRM4 Email: Sending Emails by Pointing to Gmail SMTP ServerRequirements:
<blockquote>• A Gmail Account<br>
• MSCRM 4 Email Router Service<br>
• MSCRM 4 Email Router Configuration Manager<br>
</blockquote>
1. Launch MSCRM 4 Email Router Configuration Manager. Under the Configuration Profile Tab, click the New button on the right.<br><br>
<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhBiDwD3-TsWOaMY7RIbjntHtB4MR4eXp_VZG7kaPbRQwfi6kRG5X_ioWtFS8LNkpcF5gOvBKTH1VUIOZ_ajlRZ2PlmB-elrMpmzx-5GvjANJcXMlNcQTiRPHl1B9IiQy48Z-5R/s1600-h/001.jpg" target="_new"><img style="cursor:pointer; cursor:hand;" src="http://i284.photobucket.com/albums/ll8/wcngai/CRMhacks/001s-2.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5305802665952442946" /></a><br><br>
2. Enter following information on the Email Router Configuration Profile dialog, General Tab:<br><br>
<pre><code>
Profile Name: <A Given Name to the Profile> (e.g. Gmail SMTP)
Direction: Outgoing
Email Server Type: SMTP
Authentication Type: Clear Text
Server: smtp.gmail.com
Use SSL: Checked
Access Credentials: Other Specified
User Name: <A Gmail User Id> (e.g. mscrm@gmail.com - make sure to include gmail.com)
Password: <The Gmail Password>
</code></pre><br><br>
3. Click on the Advanced Tab, make sure Network Port is 587: <br><br>
<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNvFRBlQMY0B7LMlKrOzKF-WLBFKWZYWE0-bCuscIdAsIi1QluSpmR9z2SOFnwLzhK4SLjvccOLUXyVIcleB5bxhDUrmz1KdtKZQNN_mkRSTbarspOzYXcDmpAyWjU2nPsueFI/s1600-h/002.jpg" target="_new"><img style="cursor:pointer; cursor:" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNvFRBlQMY0B7LMlKrOzKF-WLBFKWZYWE0-bCuscIdAsIi1QluSpmR9z2SOFnwLzhK4SLjvccOLUXyVIcleB5bxhDUrmz1KdtKZQNN_mkRSTbarspOzYXcDmpAyWjU2nPsueFI/s1600/002.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5305805436714855874" /></a><br><br>
4. Click OK button to return to the Email Router Configuration Manager:<br><br>
<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj0M9wxqE6BugC4supaUSn7jG2G3YuyTtIVOYO__o0KfIBAmxQX0Z0miwqA_aTGpTHkxfyAxiZUej5zvoMskMriI6SxAS5oIWZAWkzd6zjMkVmOBrvnXbtSt9CBb826XrJuAhqB/s1600-h/003.jpg" target="_new"><img style="cursor:pointer; cursor:hand;" src="http://i284.photobucket.com/albums/ll8/wcngai/CRMhacks/003s-1.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5305807840131165906" /></a><br><br>
5. Click on the Deployments Tab, and click the New button at the right:<br><br>
<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhy71_DIE-cqR3F5FvElLkMZLEuyKo8ANBzF2OOkCTNqUnTSz8B4TlOC33fuhT4fFWYb-xQsiwOaE1Mh1GvMrNkZdjelqhcN3JqPlvwxMr6iDgJdoAaR32ql4Etyo-jo5ptPvLc/s1600-h/004.jpg" target="_new"><img style="cursor:pointer; cursor:hand;" src="http://i284.photobucket.com/albums/ll8/wcngai/CRMhacks/004s.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5305808935489436946" /></a><br><br>
6. At the Deployment dialog, enter information below:<br><br>
<pre><code>
Deployment: My Company
Microsoft Dynamics CRM Server: http://<SERVER_URL>/<Organization Name> (e.g. http://AT71/Fish - Case Sensitive)
Access Credentials: Local System Account (or specify a Domain Account)
Default Incoming Configuration Profile: Optional
Default Outgoing Configuration Profile: Optional</code></pre><br><br>
7. Click OK button to return the Email Router Configuration Manager:<br><br>
<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEilobtRz529lPOP0LFm4-HL5q0S8qsfOfHJbgpWp2x6AedIJcUpXQIw8Q1cSh48OXT6yBRzeu5vcG87uQfjEYlnqOBOHr_UnInE3EGF_yKdT6K79vLIkshlBF_vhChdTiRNVwHR/s1600-h/005.jpg" target="_new"><img style="cursor:pointer; cursor:hand;" src="http://i284.photobucket.com/albums/ll8/wcngai/CRMhacks/005s-1.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5305809855317315426" /></a><br><br>
8. In order to send out email via the MSCRM Email Router, the "E-Mail Router" option must be selected under E-mail access type - Outgoing, for all relevant users:<br><br>
<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhaWRdEu5esgqTzNTHxWfHwgSm3SWY5r3qjkv2vuXaC98ZmlBMgJu20VWknpkvEDmUeoyW5gWv3oCRG-cQaioA6liw4tV_FH-0OKBxWtMF4vD8gncKRd9lHfs7-PpjVcH32Jep9/s1600-h/006.jpg" target="_new"><img style="cursor:pointer; cursor:hand;" src="http://i284.photobucket.com/albums/ll8/wcngai/CRMhacks/006s-1.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5305810480246502770" /></a><br><br>
9. Go back to the Email Router Configuration Manager, click on "Users, Queues, and Forward Mailboxes" Tab. Select the appropriate MSCRM instance, and click on the "Load Data" button, a list of users which has been configured to send or receive email via Email Router will be shown, select the relevant user and click on the Modify button:<br><br>
<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj2J8_CLBY-evxmL8QVEanXZ7JbB2zujFZ0u_7za9Z6tgW-PaG3oI33UpUXQLBNX54X0Tf3rq1EXbfmw0drzRbnlwqlhPSJ2A3qUDuVZ6cHrMWdvE24OtziV2SPW_aroxOW2MnX/s1600-h/007.jpg" target="_new"><img style="cursor:pointer; cursor:hand;" src="http://i284.photobucket.com/albums/ll8/wcngai/CRMhacks/007s.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5305811051519071874" /></a><br><br>
10. Select the Outgoing Configuration Profile which has been configured earlier (e.g. Gmail SMTP), and click the OK button:<br><br>
<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhUVuZftrSoQIVgtx5RaE6kCg2F0VtaJ80T0-NI15Aw-zOyCxcoLkjidP7ceW2UYzCBx7o2iWYjGoFc5w3ZoCyAmU7BE-xlAiyChyA8tPH80t_KBUZAE3QlHUzaUgNWr-8gkwl5/s1600-h/008.jpg" target="_new"><img style="cursor:pointer; cursor:hand;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhUVuZftrSoQIVgtx5RaE6kCg2F0VtaJ80T0-NI15Aw-zOyCxcoLkjidP7ceW2UYzCBx7o2iWYjGoFc5w3ZoCyAmU7BE-xlAiyChyA8tPH80t_KBUZAE3QlHUzaUgNWr-8gkwl5/s1600/008.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5305811495104527122" /></a><br><br>
11. Click on the "Test Account" button to verify the configurations:<br><br>
<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_d7jQjR-L3BbsPqnrYmhdmfHXOq09EUFo17PMl9xxFZ50ej3zfXtERKmGl-cCu4dzqlDciaopMirAExJ_KvbL8x75P7R1l2wsBb7TJydczvL077lSg0I5HeGOEDPA9Mx4Ur_y/s1600-h/009.jpg" target="_new"><img style="cursor:pointer; cursor:hand;" src="http://i284.photobucket.com/albums/ll8/wcngai/CRMhacks/009s.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5305815597668311538" /></a><br><br>
12. Click the Publish button to apply the changes. <br>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-31667331.post-19578889987596475952008-09-17T15:52:00.000+08:002009-03-17T16:23:52.725+08:00MSCRM4 Diagnostic: Plug-in throwing exception: "The request failed with HTTP status 400: Bad Request"This error:<br><br>
• Could be caused by the internal URL being referred by the plug-in is incorrect<br>
• When plug-in executing CrmService action (e.g. Update, Create, and etc.), the error will be thrown.<br><br>
Details of the error:<br>
<img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgI9iyhQOrkycp2ehjuMZrxrRLY-l7SDiYkGOSHbAKqXPh6ndvU6Flb00aLoPkCcMVJOr4Q_SJ6mudDRGfWU1rSZET2kMpA9H63zd9D496m9SfWcQA3VDslVO2KBenjlDvQI82b/s1600/001.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5314061680265178690" /></img><br><br>
Details of the error while debugging in Visual Studio:<br><br>
<img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg6h9xdjYTS_XV4GUtfR866SXJXxeftsAXeL4MkfPwDo9qo9Ml-1HKpG5XLb6FxClGoZbRka0P6s1Y2AwGk4faxsILIXMnp67EJ81GwRY44m7Yv1c6xBlw_q85nnHVsOpPyBgl0/s1600/002.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5314062273537922994" /></img><br><br>
Resolution:<br><br>
1. On the server, run regedit.exe.<br>
Navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSCRM.<br><br>
2. Add following values under the MSCRM node:
<blockquote><font color="#660033" face="Courier New" size="2">
Name: LocalSdkHost<br>
Type: String<br>
Value: <web_server_name> (host name or host header)<br>
<br>
Name: LocalSdkPort<br>
Type: DWORD<br>
Value: <web_server_port_number></font></blockquote>
3. Retry the plug-in execution.<br>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-31667331.post-28668731214146310762008-07-16T08:58:00.007+08:002008-12-27T10:17:41.104+08:00MSCRM 4.0 Client: Building FetchXML Query Using Advanced FindMicrosoft CRM 4 Advanced Find feature can be used for building FetchXML query:<br><br>
1. Use Advanced Find to specify the criteria and select the desire columns, execute the query, and verify the results.<br><br>
2. Press F11, key in <font color="#660033" face="Verdana" size="1">javascript:prompt("Result",resultRender.FetchXml.value);</font> into the address bar, and press <ENTER>.<br><br>
<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhoOF2Bp2UsrO6dRxhAA-WioijgsTsQK-RCJgIaCZjaSwW7qCZ46MNLV1JEx30WHKggNTdWlEKQcezR-rLrFOV3ARvFTB4KRC-oY4ZBYcQmStIuOeVacp0nGfwkYaPN-ZqTZoiQ/s1600-h/sdk001.JPG" target="_new"><img style="cursor:pointer; cursor:hand;" src="http://i284.photobucket.com/albums/ll8/wcngai/CRMhacks/sdk001s.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5283897464577174754" /></a><br><br>
3. A javascript prompt window will appear. The prompt result will be the FetchXML query:<br><br>
<img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzwotrD7S7XYY7O8xxTzEQloFhmR5GgJK125i_f8Oqatb9ogXoLNN3erYsVXcH8PXp5iOSfYcmh7xbdKYbu-ku2NVQP7TnKp48mwFzRR1xgauErkNwr1bQntgGA70e_bFgbX5u/s1600/002.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5283898243341571314" /></img>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-31667331.post-64427332798396216682008-06-26T08:02:00.000+08:002009-03-17T16:29:10.934+08:00MSCRM4 Configuration: Configure MSCRM Services to run under Domain User AccountThe MSCRM services can be configured to run under Domain User Account during installation. But it still can be changed after installation has been completed.<br><br>
1. Create a Domain User Account (e.g. MSCRM4Service) using the dsa.msc tool (Active Directory Users and Computers).<br><br>
2. On the MSCRM Web Server, launch the Internet Information Services (IIS) Manager, locate the CRMAppPool and right click Properties. Go to the Identity Tab, and change the Application Pool Identity to the Domain User Account.<br><br>
<img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiHArbzalZMg0fVV84nGFMF1jHcxNSDHNQiarf6-T1FABUXAvBcZlZ2OezcYdog__qVfyDhDhutrKCMO1Fbuu95WRY4oriCivoBxP1VafUsQln6xu_r5nlf4-tAXQst36OA-tHJ/s1600/007.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5283883113273512850" /></img><br><br>
3. Add the Domain User Account to the local group (on the MSCRM Web Server): <font color="#660033" face="Verdana" size="1">CRM_WPG (CRM Worker Process Group)</font>.<br><br>
<img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEitzjGl17PJATyRUH_m4rx2Sm51tiAft3WnBMedp9ZRqx7t8O3bjJBDdtHF5URvK8H8GIg-HZeR2t9MJtRlhZaKfgJ3LwGrlX7kpmlQj1L95p6Hih4yVBFkM8ILv6gHer8PvZug/s1600/001.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5283882731249798866" /></img><br><br>
4. Add the Domain User Account to the local group (on the MSCRM Web Server): <font color="#660033" face="Verdana" size="1">IIS_WPG (IIS Worker Process Group)</font>.<br><br>
<img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_uzwH_6DMZCjM2nmw4MnU_n6-qYG7rxUeNteupkfgQRLhnPVwU8HUPtroUme98kCZKySZnQEPgDEr5Ktjsc-9-wqvmEzYDJgDwzQMHnsOneiW7uQLc3YapWviSslxVcWvMQm4/s1600/002.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5283884298581251122" /></img><br><br>
5. Add the Domain User Account as a member to the SQLAccessGroup in the Active Directory (please take note of the proper GUID for the SQLAccessGroup).<br><br>
<img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0EN4kFRhQVIc-pQBk3AU13rAnwVewSXBaqK_m884CkbQwcay3IRc86FNkQ6vjLMA1Dg0mqds85Q3veBlVqFZWr2-8Q4WW9WH9SEACMNU_AxYKxer_ME9LIQ8SV-uirZAW-_C6/s1600/003.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5283885355917409698" /></img><br><br>
6. Add the Domain User Account as a member to the PrivUserGroup in the Active Directory (please take note of the proper GUID for the PrivUserGroup).<br><br>
<img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjKifNt5n3BqhlISzvT1hdBEj0MSZ5jExdSxS4w2XPMuhTaNBvBgbNEmXxOHg7T-Zp2O5aQi6NbnjDG2MpLJtMAVHeo7QHYSGka8vjBqaEETCuJroA3yi8SzCOoKh-iq1KYh85P/s1600/004.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5283885766529160242" /></img><br><br>
7. Create a Login for the Domain User Account in the SQL Server.<br><br>
<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgrXrgxDg5yYbmLjlawudDzlda0uCTeVd6EErvcEixhVSyY8T4femxczASqMtn8r2dVdyBLeS1hk4EqJo-Ap1IicVW7K_-nVuUlz6pMSJR0IW0eNCXTSc7k1341FoETL8P_pjXX/s1600-h/005.JPG" target="_new"><img style="cursor:pointer; cursor:hand;" src="http://i284.photobucket.com/albums/ll8/wcngai/CRMhacks/005s.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5283887006931547170" /></a><br><br>
8. Configure appropriate mappings for the Domain User Account for databases MSCRM_Config and Organization_MSCRM, assign the db_owner role for both.<br><br>
<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEizA0VCm2TesY4JjaOkoLbE5LernTHyNDfQnCSDInKz0f0ZzfEH1SIS2JgywQDV-lu9luViWNm5SNvFSYpgWx8nS31biCvph0Mj-e_2RHkBEt3HnL2l7GwslTOu8daYtRyKdR8i/s1600-h/006.JPG" target="_new"><img style="cursor:pointer; cursor:hand;" src="http://i284.photobucket.com/albums/ll8/wcngai/CRMhacks/006s.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5283887936193034098" /></a><br><br>
9. Launch ADSI Edit (adsiedit.msc) <br>
10. Expand node <font color="#660033" face="Verdana" size="1">Domain [Domain Name]</font><br>
11. Expand node start with <font color="#660033" face="Verdana" size="1">DC=</font> under the domain node<br>
12. Expand node <font color="#660033" face="Verdana" size="1">CN=Users</font><br><br>
13. Locate the Domain User Account created in Step 1 (e.g. CN=MSCRM4Service), right click and select Properties<br><br>
<img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhyA1VS-HPLa3u5S7VwTuQH2ddXGgtJEr9s1hZ2kNnxUisOVFl0QJ1ppBhMsImPjbTznOgRdUxj1l3VMgPJFVsx7i6Rv720ORhYdWUNKOlUkzuBcNBNyhVonXD1d77e5igJruuR/s1600/008.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5283889430535027906" /></img><br><br>
14. Locate the Attribute <font color="#660033" face="Verdana" size="1">servicePrincipalName</font> and click on Edit. Add following entries:
<blockquote>• HOST/HostName<br>
• HOST/HostName.FQDN (Fully Qualified Domain Name)<br><br></blockquote>
<img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhDUN9HA-PT80spWJutxAjsvN4cvJd0dALH0sJfpeP3856VR3-pQGm0zP6PLQqrxRPY8fPC3BxBtg_gc6rkNyibi4h8qA78j8q_ykGZ0dCDbK389P6ojIGaB8fWjO5gOSIf0BZM/s1600/009.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5283890827216289554" /></img><br><br>
15. Restart the MSCRM Server.<br>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-31667331.post-36948290845876667202008-06-13T08:11:00.000+08:002008-12-26T08:02:28.613+08:00MSCRM4 Configuration: Configure IIS to support both Kerberos and NTLM protocolsTo ensure the IIS supports both Kerberos and the NTLM protocols, the <font color="#660033" face="Verdana" size="1">NTAuthenticationProviders</font> metabase property must be set to <font color="#660033" face="Verdana" size="1">"Negotiate, NTLM"</font>.<br><br>
By default, the <font color="#660033" face="Verdana" size="1">NTAuthenticationProviders</font> metabase property will not be defined when IIS installed. The <font color="#660033" face="Verdana" size="1">"Negotiate, NTLM"</font> will be used as the default value when the <font color="#660033" face="Verdana" size="1">NTAuthenticationProviders</font> metabase property is not defined. So, the <font color="#660033" face="Verdana" size="1">NTAuthenticationProviders</font> metabase property will not need to be configured to use the <font color="#660033" face="Verdana" size="1">"Negotiate,NTLM"</font> property value unless the default value has been overwritten.<br><br>
To check the current value for <font color="#660033" face="Verdana" size="1">NTAuthenticationProviders</font> metabase property:<br><br>
1. Launch Internet Information Services (IIS) Manager, find out the Web Site ID:<br><br>
<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj9OWc_XZwilySSPUUypsDDK0P3zgcaBNwPVgorpFfXxNOCnf4ZKgCGydCGv-YzfjvzhFiYKOpAcFTXlN6ufmoYG6rxtk8AKgrcKWXgU5u-PN4iFMp2YrI0dG0-vA9QQl0CoUUT/s1600-h/Configure+IIS.jpg" target="_new"><img style="cursor:pointer; cursor:hand;" src="http://i284.photobucket.com/albums/ll8/wcngai/CRMhacks/ConfigureIIS-s.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5282772154668907442" /></a><br><br>
2. Start command prompt<br>
3. Go to directory <font color="#660033" face="Verdana" size="1">C:\Inetpub\Adminscripts</font>
4. Enter command: <font color="#660033" face="Verdana" size="1">cscript adsutil.vbs get w3svc/<Web Site Id>/root/NTAuthenticationProviders</font><br><br>
If the <font color="#660033" face="Verdana" size="1">NTAuthenticationProviders</font> metabase property has not been configured, result below will be shown:
<blockquote><font color="#660033" face="Verdana" size="1"> The parameter "NTAuthenticationProviders" is not set at this node.</font></blockquote>
else, the configured value will be shown (example):
<blockquote><font color="#660033" face="Verdana" size="1">NTAuthenticationProviders : (STRING) "Negotiate,NTLM"</font></blockquote>
To configure the <font color="#660033" face="Verdana" size="1">NTAuthenticationProviders</font> metabase property to support Kerberos and the NTLM protocols (Negotiate):
<blockquote>• At the command prompt, go to directory <font color="#660033" face="Verdana" size="1">C:\Inetpub\Adminscripts, enter command cscript adsutil.vbs set w3svc/<Web Site Id>/root/NTAuthenticationProviders "Negotiate,NTLM"</font></blockquote>
To remove the value for the <font color="#660033" face="Verdana" size="1">NTAuthenticationProviders</font> metabase property:
<blockquote>• At the command prompt, go to directory <font color="#660033" face="Verdana" size="1">C:\Inetpub\Adminscripts, enter command cscript adsutil.vbs delete w3svc/<Web Site Id>/root/NTAuthenticationProviders</font></blockquote>
<b>Authentication Test Page</b><br>
A Web Page such as below can be used to test the Authentication Mode currently used for the communication:<br><br>
<pre><code>
<%@ Page Language="C#" %>
<html>
<head>
<title></title>
</head>
<body>
<%= "LOGON_USER: " + Request.ServerVariables["LOGON_USER"] + "<br>" %>
<%= "AUTH_USER: " + Request.ServerVariables["AUTH_USER"] + "<br>" %>
<%= "AUTH_TYPE: " + Request.ServerVariables["AUTH_TYPE"] + "<br>" %>
<%= "HTTP_Authorization: " + Request.ServerVariables["HTTP_Authorization"] + "<br>" %>
</body>
</html>
</code></pre>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-31667331.post-9988148030687516222008-05-22T10:12:00.001+08:002008-12-22T10:22:39.951+08:00MSCRM4 Diagnostic: The user Id is invalidThis error can be caused by:<br><br>
• The MSCRM 4 Server wasn't added to the PrivUserGroup<br>
• The service account for MSCRM 4 Server wasn't able to impersonate the actual user<br><br>
<b>Details of the error:</b><br><br>
<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh-m6dmtp_CJFP3hiZT_PLs3E1XIeSvD3AfCDQRSCzjzcolJ5IqGYYpgfNKAKGJEepdGiBGQlpmGSFmX_WzK3I3s6Bn8whHhxeJyiv67_twGk2kHzB05jy_w81HQc4u7ZWS_Dpe/s1600-h/001.jpg" target="_new"><img style="cursor:pointer; cursor:hand;" src="http://i284.photobucket.com/albums/ll8/wcngai/CRMhacks/001s-1.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5282432139062221058" /></a><br><br>
<b>Error Description:</b><br>
The user Id is invalid.<br><br>
<b>Error Number:</b><br>
0x80041D1F<br><br>
<b>Full Stack:</b><br>
<pre><code>
[CrmException: The user Id is invalid.]
at Microsoft.Crm.BusinessEntities.SecurityLibrary.GetPrivilegedUserCallerAndBusinessGuidsFromThread(WindowsIdentity identity, IOrganizationContext context)
at Microsoft.Crm.BusinessEntities.SecurityLibrary.GetCallerAndBusinessGuidsFromThread(WindowsIdentity identity, Guid organizationId)
at Microsoft.Crm.Sdk.InProcessCrmService.Execute(Object request)
at Microsoft.Crm.Application.Platform.ServiceCommands.PlatformCommand.ExecuteInternal()
at Microsoft.Crm.Application.Platform.ServiceCommands.RetrieveCommand.Execute()
at Microsoft.Crm.Application.Platform.DataSource.Retrieve(String entityName, Guid entityId, String[] columns)
at Microsoft.Crm.Application.MasterSiteMap.LoadMasterSiteMapInternal(Guid organizationId, DynamicMetadataCache metadataCache, Boolean useReferenceXml)
at Microsoft.Crm.Application.MasterSiteMap.LoadMasterSiteMap(Guid organizationId, DynamicMetadataCache metadataCache)
at Microsoft.Crm.Caching.MasterSiteMapCacheLoader.LoadCacheData(MasterSiteMapCacheKey key, IOrganizationContext context)
at Microsoft.Crm.Caching.BasicCrmCache`2.CreateEntry(TKey key, IOrganizationContext context)
at Microsoft.Crm.Caching.BasicCrmCache`2.LookupEntry(TKey key, IOrganizationContext context)
at Microsoft.Crm.Application.SiteMap.GetSiteMapForUser(IUser user, Client client, Boolean isOffline, String forceGroupProfiles)
at Microsoft.Crm.Caching.UserSiteMapCacheLoader.LoadCacheData(UserSiteMapCacheKey key, IOrganizationContext context)
at Microsoft.Crm.Caching.BasicCrmCache`2.CreateEntry(TKey key, IOrganizationContext context)
at Microsoft.Crm.Caching.BasicCrmCache`2.LookupEntry(TKey key, IOrganizationContext context)
at Microsoft.Crm.Caching.UserSiteMapCache.LookupEntry(Guid userId, IOrganizationContext context)
at Microsoft.Crm.Web.Loader.ConfigurePage()
at Microsoft.Crm.Application.Controls.AppUIPage.OnPreRender(EventArgs e)
at Microsoft.Crm.Web.Loader.OnPreRender(EventArgs e)
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
[HttpUnhandledException: Exception of type 'System.Web.HttpUnhandledException' was thrown.]
at System.Web.UI.Page.HandleError(Exception e)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context)
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at ASP.fish_loader_aspx.ProcessRequest(HttpContext context)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
</code></pre><br><br>
<b>Resolution:</b><br><br>
1. Add the computer as a member to the PrivUserGroup in the Active Directory (can be achieved using dsa.msc tool):<br><br>
<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhHql8Ztad2RIMtlT6XbHtl1RSiQJaMpiCJBR7uziRD2aU-1DzynZI5ZjRuuvBwTK63aUR-WoIWz1aHcAdlTe-RhyphenhyphenvrAXR7NO84Vwhe5QYKOy4xBU4UEx4wVn-qLqnXNT_BA8uG/s1600-h/002.jpg" target="_new"><img style="cursor:pointer; cursor:hand;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhHql8Ztad2RIMtlT6XbHtl1RSiQJaMpiCJBR7uziRD2aU-1DzynZI5ZjRuuvBwTK63aUR-WoIWz1aHcAdlTe-RhyphenhyphenvrAXR7NO84Vwhe5QYKOy4xBU4UEx4wVn-qLqnXNT_BA8uG/s1600/002.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5282432878872724914" /></a>Unknownnoreply@blogger.com2tag:blogger.com,1999:blog-31667331.post-75115837759983299772008-04-28T13:05:00.000+08:002009-03-17T16:19:48.335+08:00MSCRM4 Diagnostic: Cannot open database "MSCRM_CONFIG" requested by the login. The login failed.This error can be caused by following scenarios:<br><br>
• Redeployment<br>
• Moving database to another server<br>
• Upgrades <br>
• Changing from multiple-server environment to single-server environment<br>
• Install MSCRM 4 on existing MSCRM 4 database<br>
• Install MSCRM 4 on existing MSCRM 4 multiple-server environment database<br>
• or whatever activity that causing this issue<br><br>
Details of the error:
<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgfehH-N0NFjSJkBMxkzQLgJ78RIejJR2IA8pVhSpAuo3gnv90IbgkzHngPpAmIC3BAioXy9512eifLlvmrm_JSYupbKZGoCPLwqQgA69b2lSKKTZ_zSnQi0kPOgu6mfXnQh5Sm/s1600-h/001.jpg" target="_new"><img style="cursor:pointer; cursor:hand;" src="http://i284.photobucket.com/albums/ll8/wcngai/CRMhacks/001s.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5282112849126491362" /></a><br><br>
<b>Exception Details:</b> System.Data.SqlClient.SqlException: Cannot open database "MSCRM_CONFIG" requested by the login. The login failed.<br>
Login failed for user 'DOMAIN\SERVER$'.<br><br>
<b>Stack Trace:</b>
<pre><code>
[SqlException (0x80131904): Cannot open database "MSCRM_CONFIG" requested by the login. The login failed.
Login failed for user 'DOMAIN\SERVER$'.]
System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +437
System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +82
System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +105
System.Data.SqlClient.SqlConnection.Open() +111
Microsoft.Crm.CrmDbConnection.Open() +213
Microsoft.Crm.SharedDatabase.DatabaseMetadata.LoadMetadataXmlFromDatabase(CrmDBConnectionType connectionType, String connectionString, Int32& maxBlobSize) +89
Microsoft.Crm.SharedDatabase.DatabaseMetadata.LoadCacheFromDatabase(CrmDBConnectionType connectionType, String connectionString) +22
Microsoft.Crm.ConfigurationDatabase.ConfigurationMetadata.get_Cache() +76
Microsoft.Crm.ConfigurationDatabase.ConfigurationDatabaseService.InitializeMetadataCache() +5
Microsoft.Crm.SharedDatabase.DatabaseService.Initialize(String tableName) +20
Microsoft.Crm.SharedDatabase.DatabaseService.Retrieve(String tableName, String[] columns, PropertyBag[] conditions) +297
Microsoft.Crm.ServerLocatorService.GetSiteSettingIdFromDatabase() +107
Microsoft.Crm.ServerLocatorService.GetSiteSettingId() +156
Microsoft.Crm.ServerLocatorService.GetSiteSetting(String settingName) +32
Microsoft.Crm.CrmTrace.get_RefreshTrace() +429
[TypeInitializationException: The type initializer for 'Microsoft.Crm.ApplicationSqmHelper' threw an exception.]
Microsoft.Crm.MainApplication.Application_OnStart() +476
</code></pre><br><br>
<b>Resolution:</b><br><br>
1. Add the computer as a member to the SQLAccessGroup in the Active Directory (can be achieved using dsa.msc tool):<br><br>
<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEijFeRsIKtAbcu0qnEW2qsHHT5Ejs_5jDdHZk3Ucr1DXFuzvE5xWVKOEohOUVfCSnDhD9lcWB0Ate4pFmHAeRORNNJ5un51wpVM3fi2ZTnpY38hpU-qugHmOU5BH7lnROuQj0yt/s1600-h/002.jpg" target="_new"><img style="cursor:pointer; cursor:hand;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEijFeRsIKtAbcu0qnEW2qsHHT5Ejs_5jDdHZk3Ucr1DXFuzvE5xWVKOEohOUVfCSnDhD9lcWB0Ate4pFmHAeRORNNJ5un51wpVM3fi2ZTnpY38hpU-qugHmOU5BH7lnROuQj0yt/s1600/002.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5282117946896567202" /></a><br><br>
2. Open Management Studio on the database server, expand Server>Security>Logins and right click on the NT AUTHORITY\NETWORK SERVICE and select Properties.<br><br>
3. At the left, select User Mapping, and configure appropriate mapping for MSCRM_CONFIG and Organization_MSCRM, assign db_owner for both.<br><br>
<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiWYTqSH78ctw6M1EV_LZ6AY-o83XWWilgN6r9yJClKRvJk1DLmbg7SPb2GsK_8C73LP_Gl9uJyG68awY5vX_1xISMRZPd284AfjzOwsYGK4nYR81Ci1g0rgebvMxH8cd4d0A00/s1600-h/003.jpg" target="_new"><img style="cursor:pointer; cursor:hand;" src="http://i284.photobucket.com/albums/ll8/wcngai/CRMhacks/003s.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5282120358958987602" /></a><br><br>
4. Restart MSCRM 4 Server.Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-31667331.post-50468952570773811822008-04-25T17:45:00.000+08:002009-03-17T16:31:21.535+08:00Web Service: Enabling Web Service Test Form for Remote ClientTo enable the Web Service Test Form for remote machine, edit following in the Web.Config:
<pre><code>
<system.web>
...
...
...
<webServices>
<protocols>
<add name="HttpPost" />
<add name="HttpGet" />
</protocols>
</webServices>
...
...
...
<system.web></code></pre><br><br>
This should be enabled for debugging purposes only. For production, this should be disabled (by removing or commenting tags above).<br>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-31667331.post-83375086249310153222008-03-10T23:46:00.000+08:002009-03-17T16:35:02.486+08:00MSCRM 4.0 Client: detachCloseAlert();<p>To disable alert for closing unsaved form :<br>
<br>
<font color="#660033" face="Courier New" size="2">
crmForm.detachCloseAlert();
</font>
</p>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-31667331.post-50627807947335726682008-02-16T22:12:00.010+08:002008-12-21T22:21:59.727+08:00MSCRM 4.0 Client: Hiding Buttons by IdTo hide a button in MSCRM 4.0 with the button id:<br>
<pre><font color="#660033" face="Courier New" size="2">
var objElement = document.getElementById('_MBcrmFormSaveAndClose');
objElement.innerHTML='<SPAN><SPAN><SPAN><SPAN></SPAN></SPAN></SPAN></SPAN>';
</font></pre><br><br>
A function can be created to show/hide buttons by providing the Button Id:<br>
<pre><code>
// show: bool. Show = true, Hide = false
// id: string. Button Id
// tags: string. Object to stored the HTML tags
crmForm.ShowButton = function(show, id, tags)
{
// Retrieve relevant button element based on Id
var objElement = document.getElementById(id);
var returnValue = null;
// Show Button
if (show)
{
// Ensure the HTML tags for showing button is available
if (tags != null)
{
// Restore HTML tags for showing button
objElement.innerHTML = tags;
}
}
// Hide Button
else
{
// Store the HTML tags so that it can be restored when showing button
returnValue = objElement.innerHTML;
objElement.innerHTML='<SPAN><SPAN><SPAN><SPAN></SPAN></SPAN></SPAN></SPAN>';
}
return returnValue;
}
</code></pre><br><br>
To call the function to hide a button:<br>
<pre><font color="#660033" face="Courier New" size="2">
crmForm.SaveAndCloseButtonTags = crmForm.ShowButton(false,
"_MBcrmFormSaveAndClose", crmForm.SaveAndCloseButtonTags);
</font></pre><br><br>
To show the button:<br>
<pre><font color="#660033" face="Courier New" size="2">
crmForm.SaveAndCloseButtonTags = crmForm.ShowButton(true,
"_MBcrmFormSaveAndClose", crmForm.SaveAndCloseButtonTags);
</font></pre><br><br>
To remove the button completely:<br>
<pre><font color="#660033" face="Courier New" size="2">
var objElement = document.getElementById('_MBcrmFormSaveAndClose');
objElement.outerHTML='<SPAN><SPAN><SPAN><SPAN></SPAN></SPAN></SPAN></SPAN>';
</font></pre><br>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-31667331.post-10957022118523519102008-02-15T15:09:00.016+08:002008-12-21T21:50:08.542+08:00MSCRM 4.0 Client: Hiding Buttons by ‘title’ AttributeTo hide a button in MSCRM 4.0 by the button title attribute:<br>
<pre><code>
var list = document.getElementsByTagName("LI");
var i = 0;
while (i < list.length)
{
if (list[i].getAttribute('title') == 'Save and Close')
{
list[i].innerHTML='<SPAN><SPAN><SPAN><SPAN></SPAN></SPAN></SPAN></SPAN>';
}
i = i + 1;
}
</code></pre><br>
Basically the button HTML will be as below (the button outerHTML property):<br>
<pre><code><LI class=ms-crm-Menu id=_MBcrmFormSaveAndClose title="Save and
Close" onclick=window.execScript(action) tabIndex=-1 action="crmForm.SaveAndClose();"><SPAN
class=ms-crm-Menu-Label><A class=ms-crm-Menu-Label onclick="return false;"
tabIndex=-1 href="javascript:onclick();" target=_self><IMG class=ms-crm-Menu-ButtonFirst
tabIndex=-1 alt="Save and Close" src="/_imgs/ico/16_saveClose.gif"><SPAN
class=ms-crm-MenuItem-TextRTL tabIndex=0>Save and Close</SPAN></A></SPAN></code></pre><br>
So, in order to hide the button, the <SPAN> tags can be replaced by:<br>
<pre><font color="#660033" face="Courier New" size="2">
list[i].innerHTML='<SPAN><SPAN><SPAN><SPAN></SPAN></SPAN></SPAN></SPAN>';</font></pre><br>
If the button required to be shown again later (e.g. based on certain condition to show/hide), the HTML can be stored into a variable before replacing the <SPAN> tags with the codes shown above, for example:<br>
<pre><font color="#660033" face="Courier New" size="2">
crmForm.CUST_SaveAndCloseHTML = list[i].innerHTML;
list[i].innerHTML='<SPAN><SPAN><SPAN><SPAN></SPAN></SPAN></SPAN></SPAN>';</font></pre><br>
So, in order to show the button: <br>
<pre><font color="#660033" face="Courier New" size="2">list[i].innerHTML = crmForm.CUST_SaveAndCloseHTML;</font></pre><br>
A function can be created to show/hide buttons (the function has been attached to the crmForm, so that it can be invoked by events triggered by any form element):<br>
<pre><code>
// show: bool. Show = true, Hide = false
// title: string. Button Title
// tags: string. Object to stored the HTML tags
// return value: HTML removed HTML tags (for hiding the button)
crmForm.ShowButton = function(show, title, tags)
{
var returnValue = null;
var list = document.getElementsByTagName("LI");
var i = 0;
// Show Button
if (show)
{
// Ensure the HTML tags for showing button is available
if (tags != null)
{
while (i < list.length)
{
if (list[i].getAttribute('title') == title)
{
// Restore HTML tags for showing button
list[i].innerHTML = tags;
}
i = i + 1;
}
}
}
// Hide Button
else
{
while (i < list.length)
{
if (list[i].getAttribute('title') == title)
{
// Return the HTML tags has been removed for hiding
// the button so that it can be used to restore when
// showing the button
returnValue = list[i].innerHTML;
// Hide button
list[i].innerHTML='<SPAN><SPAN><SPAN><SPAN></SPAN></SPAN></SPAN></SPAN>';
}
i = i + 1;
}
}
return returnValue;
}
</code></pre><br>
To call the function to hide a button (the return value has been stored into a property attached to crmForm, so that it can used again to restored the button for showing):<br>
<pre><font color="#660033" face="Courier New" size="2">
crmForm.SaveAndCloseButtonTags = crmForm.ShowButton(false,
'Save and Close', crmForm.SaveAndCloseButtonTags);</font></pre><br>
To show the button (again, the return value has been stored into a property attached to crmForm):<br>
<pre><font color="#660033" face="Courier New" size="2">
crmForm.SaveAndCloseButtonTags = crmForm.ShowButton(true,
'Save and Close', crmForm.SaveAndCloseButtonTags);</font></pre><br>
If the button need to be removed completely (instead of hiding which can be made visible again later), the hiding action should replace the outerHTML instead of innerHTML with 4 empty <SPAN> tags:<br>
<pre><font color="#660033" face="Courier New" size="2">
list[i].outerHTML='<SPAN><SPAN><SPAN><SPAN></SPAN></SPAN></SPAN></SPAN>';</font></pre>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-31667331.post-59383573621823373742008-02-10T14:15:00.013+08:002008-12-21T22:14:12.290+08:00MSCRM 4.0 Workflow: Workflow forever at the Waiting stateIf encountered workflows never get executed. First step is to create a simple workflow (for whatever entity, e.g. Update a value upon creation), and perform an action that can trigger this workflow. <br><br>
Secondly check the System Jobs to find out whether there is any issue with the workflow. For example, the workflow probably at the Waiting state (Status Reason) for long period of time (or forever):<br>
<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEifoXNLqMIYJv4i_0AZGaaq65T4vCvjb43DrMLMzFirrRdscx3wQ6szW4Nx_-jcm3Ww99WB9OdlZGSg5oBjQOzzFECjPpHWyYyhncug0oDKrL1YT5o2vDvtZ0k8DfU6H8rqWcKI/s1600-h/01.jpg" target="_new"><img style="cursor:pointer; cursor:hand;" src="http://i284.photobucket.com/albums/ll8/wcngai/CRMhacks/01s.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5196408130054934562" /></a><br><br>
Use Advanced Find to reveal the Error Code and Message Columns:<br>
<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhkPRDbsuTmR17Tqp8DEk8Wgt2GjFlxOgTxmhZsH2j_O2EqkeGmMN40u6Kr7MBDOaz0N6mIJVy6b3ba9jIaaI3HMJtTJd1wVfp7YLz_OxJFXOAA33fj-OJIskVeXPI5__Sw9Ekf/s1600-h/02.jpg" target="_new"><img style="cursor:pointer; cursor:hand;" src="http://i284.photobucket.com/albums/ll8/wcngai/CRMhacks/02s.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5196407661903499282" /></a><br><br>
If the Message column shows the error:<br>
<font color="#660033" face="Courier New" size="2">System.Net.WebException: The request failed with HTTP status 400: Bad Request.</font><br><br>
This could be due to the Async Service was unable to connect to the correct URL. To verify, connect to the database: MSCRM_CONFIG, and execute statements below:<br>
<pre><code>
SELECT NVarCharColumn
FROM deploymentproperties
WHERE columnname = 'AsyncSdkRootdomain'
SELECT NVarCharColumn
FROM deploymentproperties
WHERE columnname = 'ADSdkRootdomain'
SELECT NVarCharColumn
FROM deploymentproperties
WHERE columnname = 'ADWebApplicationRootdomain'
</code></pre><br>
Ensure the <font color="#660033" face="Courier New" size="2">NVarCharColumn</font> column shows the correct URL, else it can be fixed with the following statements (replace server and port with the appropriate values):<br>
<pre><code>
UPDATE DeploymentProperties SET
NVarCharColumn = '<server>:<port>'
WHERE ColumnName = 'AsyncSdkRootdomain'
UPDATE DeploymentProperties SET
NVarCharColumn = '<server>:<port>'
WHERE ColumnName = 'ADSdkRootdomain'
UPDATE DeploymentProperties SET
NVarCharColumn = '<server>:<port>'
WHERE ColumnName = 'ADWebApplicationRootdomain'
</code></pre><br>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-31667331.post-68301684669107751012008-01-28T09:22:00.009+08:002008-12-28T08:34:29.913+08:00MSCRM 4.0 Plug-in: Quick Start Guide Part 2 (Debugging)How to debug plug-in with Visual Studio 2005:<br><br>
1. Compile the assembly, copy following files to the MSCRM server assembly folder<br>
(e.g. C:\Program Files\Microsoft Dynamics CRM\Server\bin\assembly):<br>
<pre><font color="#660033" face="Courier New" size="2">
*.dll
*.pdb
</font></pre><br>
2. When registering the plug-in, make sure Disk is selected as the Location for the assembly.<br>
<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjqmc6C7OFjB4fCuwI1ptehMXDphcL-PIFEsaEzuCk5TepEf6P7YoMOf1U_TZk76_80pC5lYKkR00vp0AvCc5CkKlwF5u81AVr1d9Vrl9LwMilGijBiIvxWj1TvJnTOnP3WL_aa/s1600-h/b01.jpg" target="_new"><img style="cursor:pointer; cursor:hand;" src="http://i284.photobucket.com/albums/ll8/wcngai/CRMhacks/b01s.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5194204257781305346"/></a><br><br>
3. Back to Visual Studio. Under Debug menu, select Attach Process… And attach to the relevant process which will trigger the debugger:<br>
<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEim9pePGdrN14-Z5zVQd6ZTvTVziYWKcKj8YgUhOc0W-ZV7FcAByg4yfeZuJp66BVSSKNe5rPojumyE_tae0pAFhrHfJKx5Ju6oyyoJ819iPdDD8kJla1_TRzzWarBsTCbHM9Ik/s1600-h/b02.jpg" target="_new"><img style="cursor:pointer; cursor:hand;" src="http://i284.photobucket.com/albums/ll8/wcngai/CRMhacks/b02s.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5194203944248692722" /></a><br><br>
4. Back to Visual Studio and set break points:<br>
<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhWLjWyQGlAzG3E9kO_gE9z6mdojfewShsjSz0gX3aeQdrzSjsf6Myomi0aL5XjuRpZpjxc81MIghRX_iax3dnRFwxw1rEQf1dzGJ8Gfdq8zSNSPDQxMV9k9KQ-C5YdgqxyduHH/s1600-h/b03.jpg" target="_new"><img style="cursor: pointer;" src="http://i284.photobucket.com/albums/ll8/wcngai/CRMhacks/b03s.jpg" alt="" id="BLOGGER_PHOTO_ID_5194202926341443554" border="0"/></a><br><br>
5. Back to MSCRM, and perform an action which will trigger the debugger (based on the message registered for the entity)<br><br>
6. The Local window will be able to show some information for debugging:<br>
<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEitJf24NJ7snCbKB0xdWdT4FeZE3IKT9ZqUF5cIjMP0dl1humu9sbddmkcs62NgwJN51Izly82UJSrIT-djDHeIZjDf-_WTc4tDp4y6aj5hcatcQqGo72C2sXfFK8HwqKFcJ-Gh/s1600-h/b04.jpg" target="_new"><img style="cursor: pointer;" src="http://i284.photobucket.com/albums/ll8/wcngai/CRMhacks/b04s.jpg" alt="" id="BLOGGER_PHOTO_ID_5194100890803392466" border="0"/></a><br><br>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-31667331.post-27991413556533890112008-01-27T20:29:00.000+08:002009-03-17T16:38:30.815+08:00MSCRM 4.0 Plug-in: Quick Start Guide Part 1 (Creation)How to create plug-in for MSCRM 4.0:<br/><br/>
1. Create a Class Library project.<br/>
<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiu0XNfiOI0vyfsW2cdU8xRy5AuXlTfbGe3DwQKWJ7QUGWcXOdTOO2TX2JqW8HwA9AKJHlz2JJrfmUlY6Rqj9UrV8AbDq_Q05Mj0Jnq-NdM9fNKlK1mz-Arnvap1zHc8qrD2qTH/s1600-h/a01.jpg" target="_new"><img style="cursor:pointer; cursor:hand;" src="http://i284.photobucket.com/albums/ll8/wcngai/CRMhacks/a01s.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5193925136446672834" /></a><br/><br/>
2. Assign a key to the plug-in. Plug-in assembly must be strong-named and signed with a key. If no existing key available, a new key can be generated:<br/>
<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgGkNj8EKWq3IvtDAXzrJfB5TC7TlSr57h2OIa7NpZLnnmIVjeZ9fMc-j4b1Q7FnBdHgBodd_pqeoOOKcEQ-CRXZ8W1sFGUFa3lfPg1LLJpg5HjzKQmGznnU4_HuccmRUzryvPN/s1600-h/a02.jpg" target="_new"><img style="cursor:pointer; cursor:hand;" src="http://i284.photobucket.com/albums/ll8/wcngai/CRMhacks/a02s.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5193924595280793522"/></a><br/><br/>
<p>3. Add following MSCRM 4.0 SDK references:<br/><br/>
<font color="#660033" face="Courier New" size="2">
microsoft.crm.sdk.dll<br/>
microsoft.crm.sdktypeproxy.dll<br/><br/>
using Microsoft.Crm.Sdk;<br/>
using Microsoft.Crm.SdkTypeProxy;<br/>
</font></p>
<p>4. Plug-in must implement the IPlugin interface, for example:<br/><br/>
<font color="#660033" face="Courier New" size="2">
public class CaseNumber: IPlugin<br/>
{<br/><br/>
}
</font></p>
5. Sample code for generating Case Number (ticketnumber):<pre><font color="#660033" face="Courier New" size="2">
public class CaseNumber: IPlugin
{
public void Execute(IPluginExecutionContext context)
{
// Ensure DynamicEntity is available
if (context.InputParameters.Properties.Contains("Target") &&
context.InputParameters.Properties["Target"]is DynamicEntity)
{
// Retrieve the DynamicEntity
DynamicEntity entity =
(DynamicEntity)context.InputParameters.Properties["Target"];<br>
// Ensure the DynamicEntity is incident
if (entity.Name == EntityName.incident.ToString())
{
// Update the ticketnumber Property
entity.Properties["title"]= DateTime.Now.ToString();
}
}
}
}</font></pre>
6. Compile and register the plug-in with the MSCRM Plug-in Registration Tool:<br/>
<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhPNk-PoaAzraBuo8-7253nKuh0EEZRnzQ2xgh4VwRW-Vffvk96TlaUS81GGi1HIh2cqTOBMa8Aw73saiGnu0DKzyTe1sPaJavQTHPVyj7pLLl2PohQmhq6IoQaIB2vCW-L_FR7/s1600-h/a03.jpg" target="_new"><img style="cursor:pointer; cursor:hand;" src="http://i284.photobucket.com/albums/ll8/wcngai/CRMhacks/a03s.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5193902832681504674"/></a><br/><br/>
7. The plug-in can be stored (deployed) to MSCRM database, the server hard disk or the GAC. If the Disk option is selected, the assembly file must be placed into C:\Program Files\Microsoft Dynamics CRM\Server\bin\assembly at the server (assuming this is the MSCRM installation path).<br/>
<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEheSgd2QRzme5c0v3iFLOj4ldVr5IYV27HXOPiKUaGDIZyieCmzfx1PQhX3MVra9cQQYDzjIWkIaTofnLW0kOyLItTSo1CiKIkzpSh1gnLmeo5x4Tet-SLy3VGrgbysFIqc1tKp/s1600-h/a04.jpg" target="_new"><img style="cursor:pointer; cursor:hand;" src="http://i284.photobucket.com/albums/ll8/wcngai/CRMhacks/a04s.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5193902605048237970"/></a><br/><br/>
8. Register new step for the plug-in:<br/>
<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJR-x7NwNTSpDpG3QoTTn5a5_oqt9_SPS7juGxzRwzxu8fYGyWYvt2-Ac1rW8jIAqa_82M_tn5Q5s09iuFHCtdwGuSc1WP2l-cp_mrKqR_4uM_DMM2vRnCValgJjU0FW-88c8u/s1600-h/a05.jpg" target="_new"><img style="cursor:pointer; cursor:hand;" src="http://i284.photobucket.com/albums/ll8/wcngai/CRMhacks/a05s.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5193902330170331010"/></a><br/><br/>
9. For example, the assembly subscribed to Create event (Message), incident as the Primary Entity, and the Stage is Pre Stage:<br/>
<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgAkvARnnawMtosJ2jGh1afOCltS8X6mraHoRHz1RnfIykutiausMFbIIwltfhAEm5a3PKamI3uilo5qwVJseyZTdCssR5tJrEGSCxl5tACX25QqN6CkKRdqQdUZwi7mVEELoGp/s1600-h/a06.jpg" target="_new"><img style="cursor:pointer; cursor:hand;" src="http://i284.photobucket.com/albums/ll8/wcngai/CRMhacks/a06s.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5193902106832031602"/></a><br/><br/>
10. If Pre-Image or Post-Image is required by the plug-in, a new Image can be registered:<br/>
<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhG9bDZ1P2uGyyhCuIhY7QmRETrlZjc7Nijwm3DUbID-BOZ8OEygQplKeUQDEOr_t_VkH4wInEzT2iX_KmmG57VIYq-Jhd7crra7r8ss3MRhvE37GJckHesgAJKLYa9Se8h82LO/s1600-h/a07.jpg" target="_new"><img style="cursor: pointer;" src="http://i284.photobucket.com/albums/ll8/wcngai/CRMhacks/a07s.jpg" alt="" id="BLOGGER_PHOTO_ID_5193901531306413922" border="0"/></a><br/><br/>
11. Once the plug-in registered, it can be tested by performing relevant actions to trigger the plug-in event.Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-31667331.post-83271496072424876572007-01-30T15:58:00.000+08:002008-05-03T17:26:57.105+08:00SQL: RankingTo rank based on number of cases created for customers:<br>
<pre><code>
SELECT
ROW_NUMBER() OVER(ORDER BY COUNT(incidentid) DESC) AS 'Ranking',
Contact,
COUNT(incidentid) 'Incident Count'
FROM incident
GROUP BY Contact
ORDER BY COUNT(incidentid) DESC
</code></pre>
Results:<br>
<pre><code>
Ranking Contact Incident Count
------- -------------------- --------------
1 DEEPAK 110
2 GANESH LAL SHRESTHA 78
3 MIZANUR RAHMAN 36
4 WELLER 34
5 MICHELLE TONG 19
</code></pre>
To rank based on number of cases of particular Case Type created for customers:<br>
<pre><code>
SELECT
Contact,
ROW_NUMBER() OVER(PARTITION BY Contact ORDER BY COUNT(incidentid) DESC) AS 'Ranking',
CaseType,
COUNT(incidentid) 'Incident Count'
FROM #incident
GROUP BY Contact, CaseType
ORDER BY Contact, COUNT(incidentid) DESC
</code></pre>
Results:<br>
<pre><code>
Contact Rank Case Type Case Count
--------------------- ------ -------------- ----------
DEEPAK 1 APPEAL 21
DEEPAK 2 FEEDBACK 20
DEEPAK 3 COMPLIMENT 16
DEEPAK 4 MP APPEAL 15
DEEPAK 5 SUGGESTION 14
DEEPAK 6 COMPLAINT 13
DEEPAK 7 ENQUIRY 11
GANESH LAL SHRESTHA 1 ENQUIRY 16
GANESH LAL SHRESTHA 2 FEEDBACK 14
GANESH LAL SHRESTHA 3 APPEAL 13
GANESH LAL SHRESTHA 4 COMPLIMENT 10
GANESH LAL SHRESTHA 5 SUGGESTION 10
GANESH LAL SHRESTHA 6 COMPLAINT 9
GANESH LAL SHRESTHA 7 MP APPEAL 6
MICHELLE TONG 1 COMPLIMENT 6
MICHELLE TONG 2 COMPLAINT 4
MICHELLE TONG 3 ENQUIRY 3
MICHELLE TONG 4 SUGGESTION 3
MICHELLE TONG 5 APPEAL 2
MICHELLE TONG 6 MP APPEAL 1
MIZANUR RAHMAN 1 ENQUIRY 7
MIZANUR RAHMAN 2 COMPLIMENT 7
MIZANUR RAHMAN 3 FEEDBACK 6
MIZANUR RAHMAN 4 COMPLAINT 5
MIZANUR RAHMAN 5 MP APPEAL 4
MIZANUR RAHMAN 6 SUGGESTION 4
MIZANUR RAHMAN 7 APPEAL 3
WELLER 1 SUGGESTION 8
WELLER 2 FEEDBACK 7
WELLER 3 MP APPEAL 5
WELLER 4 ENQUIRY 5
WELLER 5 COMPLIMENT 4
WELLER 6 APPEAL 3
WELLER 7 COMPLAINT 2
</code></pre><br>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-31667331.post-29502224480151434462006-10-24T12:26:00.000+08:002009-03-17T16:40:45.767+08:00SQL: Select a random record<p>Selecting a random record from Table/View. Assuming the table name is Contact:<br>
<br>
<font color="#660033" face="Courier New" size="2">
SELECT TOP 1 * FROM Contact ORDER BY NEWID()<br>
GO<br>
</font>
<br>
<br>
</p>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-31667331.post-1160738542702192852006-09-19T18:50:00.006+08:002008-05-04T23:13:39.773+08:00MSCRM 3.0 Client: Hiding Tab, Menu Item and ButtonTo hide a Tab, find out the Tab Element ID, and attach codes below to form OnLoad event:<br/>
<pre><font color="#660033" face="Courier New" size="2">try
{
var objElement = document.getElementById("tab3Tab");
objElement.style.display = 'none';
}
catch(ERR) {}
</font></pre><br>
To hide a Menu Item or Button, find out the Element ID, and attach codes below to form OnLoad event:<br/>
<pre><font color="#660033" face="Courier New" size="2">try
{
// Hiding "Recalculate" Menu Item
var objElement = document.getElementById("_MIcrmFormSubmitCrmForm1truetruefalse");
objElement.style.display = 'none';
}
catch(ERR) {}<br>
try
{
// Hiding "Recalculate" Button
var objElement = document.getElementById("_MBcrmFormSubmitCrmForm1truetruefalse");
objElement.style.display = 'none';
}
catch(ERR) {}</font></pre><br><br>
Usually Menu Item will be prefixed with _MI... and button will be prefixed with _MB...<br /><br />
The same method can be used to hide an item from the left Navigation Pane.Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-31667331.post-1156671032144530272006-08-02T14:48:00.003+08:002008-05-03T23:50:48.108+08:00MSCRM 3.0 SDK: Close Opportunity<p><font face="Arial" size="2">To close a <b>Won Opportunity</b>:</font><br>
<br>
<font color="#660033" face="Courier New" size="2">
CrmService service = new CrmService();<br>
service.Credentials = System.Net.CredentialCache.DefaultCredentials;<br>
<br>
WhoAmIRequest req = new WhoAmIRequest();<br>
WhoAmIResponse res = (WhoAmIResponse) service.Execute(req);<br>
<br>
Guid OpportunityID = new Guid("{e0fbb411-cb35-db11-b3d2-0003ffc41bcc}");<br>
<br>
// Close Opportunity - Won<br>
WinOpportunityRequest wReq = new WinOpportunityRequest();<br>
opportunityclose won = new opportunityclose();<br>
<br>
// Oppoturnity ID<br>
Guid id = new Guid(OpportunityID);<br>
Lookup oLookup = new Lookup();<br>
oLookup.Value = id;<br>
won.opportunityid = oLookup;<br>
<br>
// Status Reason<br>
Status oStatus = new Status();<br>
oStatus.Value = 3; // Won<br>
won.statuscode = oStatus;<br>
<br>
// Execute Request<br>
wReq.OpportunityClose = won;<br>
wReq.Status = 3; // Won<br>
WinOpportunityResponse wRes = (WinOpportunityResponse) service.Execute(wReq);<br>
</font><br>
<br>
<font face="Arial" size="2"><b>Lost Opportunity</b>:</font><br>
<br>
<font color="#660033" face="Courier New" size="2">
// Opportunity - Lost<br>
LoseOpportunityRequest lReq = new LoseOpportunityRequest();<br>
opportunityclose lose = new opportunityclose();<br>
<br>
// Oppoturnity ID<br>
Guid id = new Guid(strOpportunityID);<br>
Lookup oLookup = new Lookup();<br>
oLookup.Value = id;<br>
lose.opportunityid = oLookup;<br>
<br>
// Status Reason<br>
Status oStatus = new Status();<br>
oStatus.Value = 5; // Out-Sold<br>
lose.statuscode = oStatus;<br>
<br>
// Execute Request<br>
lReq.OpportunityClose = lose;<br>
lReq.Status = 5; // Out-Sold<br>
LoseOpportunityResponse lRes = (LoseOpportunityResponse) service.Execute(lReq);<br>
</font>
</p>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-31667331.post-1153879535712748212006-07-26T10:05:00.002+08:002008-12-25T20:46:38.681+08:00SQL Server: Change Server Name<p>Run following command to change the server name in sys.servers system
table:<br>
<br>
<font color="#660033" face="Courier New" size="2">
sp_dropserver @server = 'old_server_name'<br>
GO<br>
sp_addserver @server = 'new_server_name', @local = 'local'<br>
GO</font><br>
<br>
Restart the server, and use command below to verify:<br>
<br>
<font color="#660033" face="Courier New" size="2">
SELECT @@SERVERNAME</font><br>
<br>
or execute command below (for SQL 2005):<br><br>
<font color="#660033" face="Courier New" size="2">
C:\>sqlcmd -A<br>
UPDATE sys.servers SET name = 'new_server_name'<br>
GO</font><br>
</p>Unknownnoreply@blogger.com0