Understanding SharePoint Document Locations for Entity based folder structure–Dynamics CRM + SharePoint integration

Recently I was handling a training in Dynamics where I was demoing the OOB CRM SharePoint integration.

Client was already using the OOB CRM-SharePoint configuration using entity based folder structure. Anyone getting confused what is meant by entity based folder structure? Well while configuring you get an option to select whether based on Account/ Contact.

I selected Account here. Not a big deal.

image

But here it gets interesting. What if I upload some documents for a child record of an account and then change the account for that child record?

To duplicate this, I followed the below steps

  • Created two accounts – Account A & Account B
  • Created a case – Case | Document Test for Account A
  • In the Documents Section, uploaded file named – Document 1.txt

Let’ see the folder structure in SharePoint after this operation.

image

No surprises here. As we have chosen Entity based folder structure, the document got uploaded for the case under the account for which the case has been logged.

Now let’s go ahead and changed the account of the case to Account B

image

Now if we go ahead an upload a Document for the case – Document 2.txt, it should roll up under Account B. Let’s see that if it happens.

I go ahead and upload the document. But surprisingly it is still uploading under Account A in SharePoint.

image

 

Strange isn’t it? But why it happens? To understand this we need to understand the Document Locations record that CRM uses to map to the corresponding folder in SharePoint.

The following are the document locations record that got created after we uploaded Document 1.txt.

image

As you can see, four document location records got created

  • One for entity – account
  • One for account record – Account A
  • One for entity – (case)incident
  • One for case record – Case| Document Test

As you can see all are named “Document on Default Site 1”. This is confusing. So let’s name it accordingly.

Below is the screenshot after renaming. Probably looks simpler now with the names.

image

Looks go ahead and create the document location record manually for Account B.

image

 

image

 

image

 

If you now come back to the Case record and move to the Documents section, you will find two document locations now but if you select the Account B Document Location record, you will find no upload button.

image

This is because the corresponding folder in SharePoint does not exist. Lets go and create that.

image

 

Now if you go ahead to the case and move to the Documents section, you would find both the Document Locations for previous and current account.

And if you now upload a document to the case for the current account, it goes and sits at the right place. And you can always switch back to see what were the documents uploaded for the previous account as well.

image

Hope this helps!

 

Debajit Dutta

(Dynamics MVP)

For training/ consulting/ tools, please visit www.xrmforyou.com

Documents Link missing in Navigation pane even after enabling Document Management in Dynamics Version 9.0

Recently I was in a training for a client where I was demoing the CRM – SharePoint  OOB integration. So I enabled the integration and then also enabled the Account Entity for Document Management.

However when I opened a Contact and tried to Navigate to the Documents section, I find no link in the Navigation Pane. Looked like the one below.

image

Bit embarrassing since just before that I told the participants that the document link would appear once I enabled the entity for Document Management.

Bit flummoxed, I checked for the relationship whether mistakenly I have made the relationship display to False. It was not the case.

Then jumped on to the form editor and clicked on the Navigation Pane and then much to my relief, I could see the Documents tab in the available relationships.

image

 

Just dragged the relationship on to the Common relationship area. Save and publish the customizations. And much to my relief I could see the Documents link in the Navigation Pane

image

 

Small thing. But saves you some moments if you know this.

 

Debajit Dutta

(Dynamics MVP)

For consulting/ tools/ training please write to us at info@xrmforyou.com or visit our website www.xrmforyou.com

{Fixed} Error while connecting to Dynamics 365 Version 9.0–Metadata contains a reference that cannot be resolved.

Recently one of our customers upgraded to Version 9.0 from D365 8.2 and then all of a sudden all the console jobs which used to connect to Dynamics CRM and were scheduled as batch jobs started failing.

Checking the event viewer we found out the following error – “Metadata contains a reference that cannot be resolved”.

Was curious to know and hence copied the portion of code which connects to CRM from batch job, into a separate console application. Sample code below

ClientCredentials clientCredentials = new ClientCredentials();

clientCredentials.UserName.UserName = “<username>”;
clientCredentials.UserName.Password = “<password>”;

            var proxy = new OrganizationServiceProxy(new Uri(“https://domainname.crm.dynamics.com/XRMServices/2011/Organization.svc”),
null, clientCredentials, null);

            <<<code to perform fetch>>>

 

It was failing while trying to create the proxy. The same code was working in Dynamics CRM version 8.2

Thought something changed in the service URL and hence copied and pasted the URL in the browser. Worked just fine.

So what can be the problem here.

So when I opened CRM in browser (firefox in this case), I just clicked on the padlock to view  the certificate information and then click on More Information (shown in screenshots below).

image

image

 

image

 

In the technical details I could see the Encryption protocol being used is TLS1.2

image

 

Just our of curiosity, I just added the below line of code before creating the proxy.

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

 

Full code.

ClientCredentials clientCredentials = new ClientCredentials();

clientCredentials.UserName.UserName = “<username>”;
clientCredentials.UserName.Password = “<password>”;

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

var proxy = new OrganizationServiceProxy(new Uri(“https://domainname.crm.dynamics.com/XRMServices/2011/Organization.svc”),
null, clientCredentials, null);

 

And voila it worked just fine.

I am still researching as to why I needed to use this in version 9.0 although TLS 1.2 was being used in the previous versions as well.

 

Hope this helps to resolve the issue and save some time.

-Debajit Dutta (Dynamics MVP)

For training/ consulting please visit www.xrmforyou.com

 

 

{Dynamics 365} Debug scripts for Dynamics 365 for phones using web browser

First of all Happy New Year to all my blog readers. It’s been sometime I have been writing something and I love the fact that I am back at quite early stage of the year.

New year, new assignment and on the very first week I am working on mobile enablement for a client. Now mobile can be Tablets/ Phone interface and here the customer was more interested towards using Dynamics 365 for Phones.

The client already had some pretty hefty scripts written on the forms and if you have already worked on enabling CRM for mobile you know the pain of debugging scripts.

Thankfully there is a trick of showing up mobile preview in browser

So if my Organization url is https://xrmforyou40.crm.dynamics.com and my org unique name is – orgffgh56 (you can find it out by going to Settings –> Customizations –> Developer Resources), the following url will show up the mobile mockup in the web browser.

https://xrmforyou40.crm.dynamics.com/nga/main.htm?org=orgffgh56&server=https://xrmforyou40.crm.dynamics.com

You might be thinking – What’s new in this? It’s been told so many times already in so many wonderful blogs.

Well yes! But there is a subtle difference to it.

The above URL will simulate how your Dynamics 365 will look in Tablets. Dynamics 365 for Phones can be tricky considering the functionalities are more limited than tablet and also the UI rendering is different from the way it renders in the tablets.

Now a small twist in the URL

https://xrmforyou40.crm.dynamics.com/nga/main.htm?org=orgffgh56&server=https://xrmforyou40.crm.dynamics.com&phone=true

 

Just adding the Phone query string at the end will do wonders and it will render just like the way it will show up in your phone.

 

Hope this helps!

 

(For consulting/ training contact us at info@xrmforyou.com)