Thursday, November 28, 2019

Download Dynamics 365 version 9.x Software Development Kit (SDK)

From Dynamics 365 version 9.x, Microsoft will no longer provide downloads for the SDK. This post provides information about where you can download the developer tools, assemblies and code samples that are shipped as part of the Software Development Kit (SDK) for Microsoft Dynamics 365 version 9.x.

Below are options available to get the SDK for version 9.x.

  • To download complete package of developer tools, Download
This zip file contains Configuration Migration Tool, Core Tools, Package Deployment, and Plugin Registration.

NOTE: After you download the zip file, you must right-click on zip and go to properties and unblock the files before you extract it.

  • Using PowerShell
You can download tools used in development from NuGet using the powershell script found on
 link.
Hope it helps someone. Cheers!!

Thursday, February 16, 2017

SQL Error: Exclusive access could not be obtained because the database is in use.

When restoring a database, one of the things you need to do is to ensure that you have exclusive access to the database.  If any other active connection is established with database then restore may get failed.

When trying to do a restore, if any other active connection is established with database you will see these types of error messages:

System.Data.SqlClient.SqlError:  Exclusive access could not be obtained because the database is in use. (Microsoft.SqlServer.Smo)

Resolution:

Make the database in single user mode and then do the restore

ALTER DATABASE AdventureWorks SET SINGLE_USER WITH ROLLBACK IMMEDIATE
GO
RESTORE DATABASE AdventureWorks FROM DISK = 'C:\AdventureWorks.BAK' 
GO

Wednesday, February 15, 2017

Progress Bar in CRM Forms

With new Dynamics CRM versions now we have even more opportunities to play with the UI. We have more choice with regards to layout, more choice with regards to user experience, and implicitly more opportunities to make it better for the user.

In this post I’m going to be talking about adding a progress bar to our Case form, to show the loading of the form. It should look something like this:

NOTE: some of the items presented in this post are not officially “supported”.

Now, let’s add the following script to the to the form and call it from OnLoad event of the form:

function showLoading() {
        //use it to change opacity of main content
document.getElementById('tdAreas').parentElement.style.opacity = '0.1';
        //use it to hide main content
//document.getElementById('tdAreas').parentElement.style.display = 'none';
var newdiv = document.createElement('div');
newdiv.setAttribute('id', 'msgDiv');
newdiv.valign = 'middle';
newdiv.align = 'center';
var divInnerHTML = "";
divInnerHTML += "";
divInnerHTML += "";
divInnerHTML += "";
divInnerHTML += "Please wait…";
newdiv.innerHTML = divInnerHTML;
newdiv.style.background = '#FFFFFF';
newdiv.style.fontSize = '15px';
newdiv.style.zIndex = '1010';
newdiv.style.margin = '0 auto';

newdiv.style.width = document.body.clientWidth;
newdiv.style.height = document.body.clientHeight;
newdiv.style.position = 'relative';
document.body.insertBefore(newdiv, document.body.firstChild);
document.getElementById('msgDiv').style.visibility = 'block';
        //use it to define ms for disable loading
//setTimeout(disableLoading, 500); 
}

function disableLoading() {
if (document.readyState === "complete") {
document.getElementById('msgDiv').style.display = 'none';
document.getElementById(‘tdAreas’).parentElement.style.opacity = ”;
//document.getElementById("tdAreas").parentElement.style.display = 'block';
}

}

Play with CRM!! 

Enjoy!

Friday, January 13, 2017

Reporting Server failed to start - The request failed or the service did not respond in a timely fashion.

Modify the registry to increase the default time-out value for the service control manager. To increase this value to 60 seconds, follow these steps:
       1. Click Start, click Run, type regedit,and then click OK.
       2. Locate and then click the following registry subkey:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control.
       3.  In the right pane, locate the ServicesPipeTimeout entry.
            Note If the ServicesPipeTimeout entry does not exist, you must créate it. To do this, follow these steps:
    1. On the Edit menu, point to New, and then click DWORD Value.
    2. Type ServicesPipeTimeout, and then press ENTER.
    3. Right-click ServicesPipeTimeout, and then click Modify.
    4. Click Decimal, type 60000, and then click OK.
      This value represents the time in milliseconds befor
            Restart the computer for the changes to take effect.
 Check that SSRS and SSIS services can be started now.

Tuesday, November 8, 2016

Set Focus on a control in CRM 2011

How to set focus on a control in CRM 2011 using Javascript


Option 1:
var control = Xrm.Page.ui.controls.get("AttributeName");
control.setFocus();

Option 2:

In some situations we need to show the alert to end user and then set the focus on the field where validation takes place, in this case setting focus directly on that fails so simply set the focus to a different field on the same tab first and then reassign the focus to the field from which the OnChange() event was called like so:


Xrm.Page.getControl("AnyFieldFromSameTab").setFocus(true);
Xrm.Page.getControl("TheFieldYouReallyWantToFocus").setFocus(true);


Wednesday, October 5, 2016

CRM 2016 New Form Rendering Engine

With the release of CRM 2016 (2015 Update 1 for CRM Online), comes a new form rendering engine built to provide better performance of form loads. The two main changes are focused around loading process of the form and the handling of the cache.

You might have noticed it when you open up an account or contact, two loading screen flash by (“requesting data from CRM” and “loading business logic”) just before your record is loaded.







If you are currently being plagued by these messages, it may be a good idea to turn the new rendering engine off. To do this, simply go to: Administration -> System Setting, scroll all the way down and you will see the “Use legacy form rendering” option. Turning it to “yes” will disable the new engine.


Monday, October 3, 2016

The specified active directory user already exists as a crm user.

We came across this error, when we were trying to Add new user into the CRM.

"The specified Active Directory user already exists as a CRM user"
"You are attempting to create a user with a domain logon that is already used by another user. Select another domain logon and try again."
This kind of error comes when you moved your database from other organization. Solution for this is explained below:
Note: This is unsupported way for the resolution. Please take a backup of both Config DB as well as MSCRM DB.
Solution 1: Please check whether the User you are trying to add is disabled. Change the view to disabled user, as the search on User entity in CRM work only for Enabled user.
Solution 2: (Unsupported)
       1.       Get SID for AD-user
1.1   Open Windows Powershell (Run as Administrator)
1.2   Type below command in the window.
$AdObj = New-Object System.Security.Principal.NTAccount("USERNAME")
$strSID = $AdObj.Translate([System.Security.Principal.SecurityIdentifier])
$strSID.Value

       2.       Login to SQL server (Config DB)
2.1   SIDs are stored in SystemUserAuthentication table of Config DB where it is being prefixed with “W:” where I think W may be referring as Windows.  Get the UserId for the SID which we identified in step 1.
select UserId,* from SystemUserAuthentication where
AuthInfo ='W:SIIDFromStep1'

       3.       I found the OrganizationId by querying the Organization table.

select Id,UniqueName from organization

       4.       I then found the SystemUserOrganizations record for the intersection of their user CRM user ID and the Org ID by running the following query:

select * from SystemUserOrganizations
where OrganizationId = 'OrganizationIDFromStep3'
AND UserId = 'UserIDFromStep2'

       5.       Backup MSCRM_CONFIG database & SystemUserOrganizations table using:

select * into SystemUserOrganizations _bak  from SystemUserOrganizations

       6.        I then deleted the SINGLE record identified in step 4.

delete from SystemUserOrganizations
where OrganizationId = 'OrganizationIDFromStep3'
AND UserId = 'UserIDFromStep2'

       7.       I went and added my user.

Again, this worked for me. I hope this helps someone else out, but your mileage may vary and don't blame me if things get messed up. :)