You are currently browsing the tag archive for the ‘Dynamics CRM 2011’ tag.

Every now and then I get stuck on something where I didn’t pay enough attention when I was reading the documentation. This is one of those cases.

I was just playing with some OData scripts, and moving from one machine to another I realized that my calls were prompting for re-authentication on one of the machines.

Anyways, I go back to the documentation, which by the way is here, and one of the notes states:

“If you access the server locally using http://localhost or use an IP address rather than the actual name of the server, this will not be reflected in the value returned by this function. This means that if you are making web service calls or accessing web resources, Internet Explorer will apply security settings that apply to requests that cross domains. To avoid this, always connect to Microsoft Dynamics CRM using the standard URL.”

Interesting. There’s some work-around posts online, one of them being the use of document.location.

Just in case, if you ever find that users get prompted for authentication when running an OData call, that should probably be the first place to check.

Enjoy!

Advertisements

These are probably the most common generic data files I use for data load. I’ve posted them here for others to use as a starting point, but mostly for me to retrieve them easily rather than have to dig for them through my portable drive.

Canadian Provinces

USA States

Countries of the World

Enjoy!

July 26, 2012: Links have been updated to point to the new location of the files.

Working with lookup fields in CRM when using JavaScript is a little different due to the way the entity is handled. The following snippets will allow you to both read a value in a look-up, as well as to populate a value in the look-up (for cases when you need to pre-define a value).

Reading the selected value in a lookup:

var lookupItem = new Array();
lookupItem = Xrm.Page.getAttribute("new_specialty").getValue();

if(lookupItem[0] != null)
{
    var name = lookupItem[0].name;
    var guid = lookupItem[0].id;
    var entType = lookupItem[0].entityType;
}

Writing to a lookup:

if(new_Country == null)
{
    // alert("Preparing to set Country:");
    var countryName = "Canada";
   
    var lookupData = new Array();
    var lookupItem = new Object();
    lookupItem.id="{A53E3645-912A-E111-92BB-00155D146C19}";
    lookupItem.name=countryName;
    lookupItem.entityType="new_country";
   
    lookupData[0] = lookupItem;
    // alert("Assigning Country to Field:");
    Xrm.Page.getAttribute("new_relatedcountryid").setValue(lookupData);
}

Enjoy!

In some instances, you might need to put a lookup on a form, and based on the selection in that lookup, retrieve additional data about the entity referenced. One such example could be either the standard entities like Account or Contact, or a custom entity you have created.

The following snippet will help you do that, but first, be aware of a few things:

1. Using OData, you can make calls back to the server, and get the values you need. Whether calling your custom entity, or the default ootb ones, the easiest way to determine what you are calling is to have a look at the XML returned by a call to the web service:

http://[servername]/[orgname]/XRMService/2011/OrganizationData.svc

the return XML will give you all the available entity names. Find the one you need in there, as you will be using it in the script.

2. Use the following script on lookup change event:

        try
        {
            //Get entity data;
            var serverUrl = Xrm.Page.context.getServerUrl();

            var odataSelect = serverUrl + "/XRMServices/2011/OrganizationData.svc/new_specialtiesSet(guid’" + guid + "’)";
            // alert("ODATA Select: " + odataSelect.toString());
           
            $.ajax({
                type: "GET",
                contentType: "application/json; charset=utf-8",
                datatype: "json",
                url: odataSelect,
                beforeSend: function (XMLHttpRequest) { XMLHttpRequest.setRequestHeader("Accept", "application/json"); },
                success: function (data, textStatus, XmlHttpRequest) {
                    var org = data.d;
                    //Change form data
                    Xrm.Page.data.entity.attributes.get("new_specialtydescription").setValue(org.new_Description);
                },
                error: function (XmlHttpRequest, textStatus, errorThrown) {
                    alert(‘OData Select Failed: ‘ + odataSelect);
                }
            }
            );
           
        }
        catch(err)
        {
            // handle the error

        }

3. Observe two highlighted sections:

new_specialtiesSet is the value obtained from the XML returned by the web service call. To this value we pass the GUID of the current entity, which we can get by using this script:

var lookupItem = new Array();
lookupItem = Xrm.Page.getAttribute("new_specialty").getValue();

if(lookupItem[0] != null)
{
    var name = lookupItem[0].name;
    var guid = lookupItem[0].id;
    var entType = lookupItem[0].entityType;
}

org.new_Description is the actual field name in the looked-up entity (new_Description).

This way you can start populating current form fields with values from the look-up entity selected by the user. Be aware though that there might be a delay from look-up value change until the call takes place, results are returned and fields are populated. Depending on the environment, this could be visible or instant.

Enjoy!

One common requirement is to control the Country/Province user input in your CRM. One approach is to actually create two new custom entities, one for Country, one for Province, and add the proper relationship for filtering. Next you can go through your system and start replacing your Country and Province to add your new entity references. Note, make sure you keep the original Country and Province, hide them, and script it so those fields get filled in, otherwise you will find that in certain instances you’re missing these values. But that’s not where I’m going with this.

Once you update your Accounts and Contacts, check all the other major entities, and you get to Address. If you’re like me, and in this case I had a requirement to allow the users to add as many addresses as they want to, you put a grid view to Address in your contact, and voila! Well, not so fast.

For the sake of consistency, I kind of want to have the same Country and Province selection method in the Address entity. But, surprise: You can’t!

clip_image001

Address is one of those entities that seem to be incomplete as far as functionality. I can create a new custom field, but when I set it up as a Lookup, I don’t get a choice to lookup any of my custom entities (or any other entity for that matter).

After some more digging, other limitations become apparent: you don’t get an option to create relationships either (whether 1:N, N:1 or N:N).

clip_image002

Views is also locked down, where you can only modify the existing views, but you cannot create your own custom view.

clip_image003

If this is in the SDK, then I must have missed it, but if you ever try this, know the limitations. Maybe the next version will finally allow us to work with what we have.

The only other option you have is pretty much to create your custom Address entity, and work with that. Good luck!

Enjoy!

I’ve had a few clients already asking about this behavior. You successfully install CRM for Outlook, whether in online only or offline mode. Everything works smooth, but when you try to configure the connection, it fails with the following message:

outlook_crm_error

“There is a problem communicating with the Microsoft Dynamics CRM server. The server might be unavailable. Try again later. If the problem persists, contact your system administrator.”

You might be thinking first to go look at the logs. They are in:

C:\users\USER\AppData\Local\Microsoft\MSCRM\Logs\Crm50ClientConfig.txt

Here you will see either an LDAP error, or missing credentials, etc. You could start researching all those messages, and most of the recommendations you will find online, including the MS KB article will tell you that this behavior is related to having Windows Live Essentials 2011 installed, and that you should do a repair on it, and/or try to re-install the Outlook client. After doing that a few times, with no luck, you might start to pull your hair.

What actually worked in my case, after 2 days of unsuccessfully trying all the suggestions, is a little bit of LOGIC. Oh yeah, that…

So, if it all comes back to authentication, and almost every other time I get the missing credentials message, where are these credentials stored then? Answer: in the Credential store. How do you get to it? Click on Start, in the Run area type “Credential” (no quotes), and the first suggestion coming back is Credential Manager. Open it.

image

image

Once opened, it will look something like this:

image

In the Generic Credentials section you will most likely find a few items starting with Microsoft_CRM_xxxxxxxx. Expand each and every one of these, and make sure that the credentials stored are indeed the correct values. In my case it was relatively easy to spot the issue, as the username field was blank.

Once the proper credentials are updated, all I had to do was to re-run the configuration, drop in the proper URL in place, test the connection, and voila, all working again like a charm.

Enjoy!

Many times I have to either test security for various users, or make customizations and test them with different accounts. As you’ve probably seen by now, your authentication/authorization is cached with the first session you log in, and any subsequent browser sessions will use the same account to log you in automatically.

Now, the trick to logging in with various users at the same time is to use the new InPrivate Browsing (Ctrl+Shift+P):

image

This will create a new and completely independent browsing session, allowing you to use multiple credentials at the same time.

Once you start the InPrivate session, your screen will look like so:

image

Additional details are provided in the window description:

image

Do check out the help file for additional benefits and detailed description of this feature.

Enjoy!

Image: two sessions running in parallel:

You’ve got your shiny new dashboard, and now you’re looking at it on that small screen. You wish you had a bigger screen, or a way to make the whole thing bigger, right?

Well, fear not, there’s a few things you can do to achieve that. First off, from CRM, you can hide the ribbon. If you click on the small arrow right next to your user name, you can hide it. If you’re a sales person though you hate clicking the mouse. Keyboard shortcuts are your friend. No problem then, in CRM you can do Ctrl+Shift+5.

image

Hiding the ribbon will keep it hidden until you explicitly unhide it, or refresh the screen, or start a new session.

Another thing to do take advantage of the full screen is, in IE, do an F11. This will put the browser in Full Screen mode (to exit full screen press F11 again).

Enjoy!

Ok, installation and IFD configuration is complete, users are going in, but they start to complain about a time-out message popping-up about 40 minutes apart or so, and getting redirected to AD FS for re-login.

Not to worry, this is actually by default, and it’s not a CRM fault. In fact this is the result of AD FS 2.0 default configuration. All you have to do is increase the time-out on the AF FS 2.0 side.

Change the time-out setting on the AD FS 2.0 box using the following PowerShell command:

Set-ADFSRelyingPartyTrust –TargetName [NAME] –TokenLifeTime [no_seconds]

Enjoy!

Just as a FYI for those CRM admins that don’t deal with infrastructure issues a lot, or have to request from a different group firewall changes, when setting up IFD for external users, with CRM 2011 on a box, and ADFS on a different one, both machines have to expose port 443 through the firewall (AD FS 2.0 binds to port 443, and assuming you set-up CRM on 443 also). Do not forget about the ADFS box, or you’ll be pulling your hair out trying to figure out what’s going on!

clip_image001

Check out the white paper from Microsoft Download Center.

Enjoy!

To close this set of tips, let’s look at a snippet of JS to set the focus on a specific control in a form:

var ctrl = Xrm.Page.ui.controls.get(“ControlName”);

control.setFocus();

Not necessarily a CRM feature but rather a JS feature, yet used in the context of CRM 2011. This works on both On-Premise and Online.

Enjoy!

Scope

The scope of this guide is to walk a user through the required steps to perform an installation of the Outlook client for CRM. These steps cover a user installation process.

Installation

1. If Outlook is running, please close Outlook.

2. Open a new browser window and navigate to the Dynamics CRM URL as provided by your IT support group or CRM Administrator.

3. When prompted, authenticate with your credentials. You will be redirected to the current CRM organization.

4. Once the page loads, the system will recognize that the CRM client for Outlook is not installed, and will prompt you to install it. You will get a yellow band underneath the Ribbon as seen in the following screenshot.

clip_image002

Figure 1 – Prompt to install CRM for Outlook

5. Click on the Get CRM for Outlook button.

6. The download prompt will appear. Click on the Run button.

clip_image004

Figure 2 – Run the installation

7. Once you click Run, the installer is downloaded, and the installation process starts.

clip_image005

Figure 3 – Downloading the installer

8. A Windows specific security feature, the User Account Control will prompt you that you are attempting to run an application downloaded from the internet, and will ask if you want to proceed. Click Yes.

clip_image007

Figure 4 – User Account Control

9. The Setup process begins by preparing the necessary files for the installation. This might take a while, depending on the local machine specifications and the internet connection speed.

clip_image008

Figure 5 – Setup process commence

10. The Agreement screen is displayed. Select the “I accept the license agreement” check box, and click on Next.

clip_image009

Figure 6 – Accept the Agreement

11. On the following screen, click on the Install Now button.

clip_image010

Figure 7 – Install Now

12. The installation process has started. The progress bar will show you the actual installation progress, with an update of the tasks that are being completed. Wait for the installation to complete.

clip_image011

Figure 8 – Installation Progress

13. At this point, the installation has completed. Click on Close to finish the installation process.

clip_image012

Figure 9 – Installation complete

14. At this point, the CRM client for Outlook is installed. Go ahead and launch Outlook.

clip_image013

Figure 10 – Launch Outlook

15. First time you launch Outlook after the CRM client installation, you will be prompted to configure the client, by pointing it to the address of your Dynamics CRM server, as well as defining the Organization you will be using.

clip_image014

Figure 11 – Configure Organization

16. Please enter the same URL you have put in the browser at step 2. Click on Test Connection.

17. Once the connection is validated, in the Organization Information area, the Organization drop-down becomes active, and the default Organization becomes the default selection. Also, the Display Name field is populated to reflect the default Organization selected.

18. If there are any issues testing the connection, or the default Organization is not being recognized, please contact your IT support personnel or your CRM administrator for assistance.

19. Once this configuration is complete, click OK.

20. The Add Organization process screen is displayed shortly, and once the process completes, you are being returned to your Outlook application.

image

Figure 12 – Adding Organization

21. To validate that the installation and configuration is complete, make sure that you have a new section called Microsoft Dynamics CRM Database button, as well as in the accounts area you have a new section named after your Organization

clip_image016

Figure 13 – CRM Database Section

image

Figure 14 – CRM Account

22. Congratulations, your CRM connector for Outlook is installed and configured. Now you are ready to use your Dynamics CRM Organization by using the same familiar interface of Outlook.

MVP Reconnect

Check out my course [Video]

Dynamics 365 Customer Engagement Administration

Dynamics 365 Customer Engagement Administration

Check out my course [Video]

Configuring and Extending Dynamics 365 Customer Engagement

Configuring and Extending Dynamics 365 Customer Engagement

Check out my course [Video]

Getting Started with Dynamics 365 Customer Engagement

Reviewed Book

Implementing Microsoft Dynamics 365 for Finance and Operations

Implementing Microsoft Dynamics 365 for Finance and Operations

Reviewed Book

Microsoft Dynamics 365 Extensions Cookbook

Microsoft Dynamics 365 Extensions Cookbook

Check out my Book

Microsoft Dynamics CRM 2016 Customization - Second Edition

Microsoft Dynamics CRM 2016 Customization - Second Edition

Check out my Book

Microsoft Dynamics CRM Customization Essentials

Microsoft Dynamics CRM Customization Essentials

Check out my Book

Microsoft Dynamics CRM 2011 Scripting Cookbook

Microsoft Dynamics CRM 2011 Scripting Cookbook

Reviewed Book

Microsoft Dynamics CRM 2011: Dashboards Cookbook

Microsoft Dynamics CRM 2011: Dashboards Cookbook

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 608 other followers

Follow Dynamics 365 Wizardry on WordPress.com