Add New (+) button not visible in sub-grid in Quick form View in Dynamics CRM 2016. Bug or expected behavior?

Back sometime I wrote a blog post on how to show related activities of an account on the contact form using Quick View feature. Here is the blog post link. Back then it was 2013 version of CRM and it generated quite an interest.

https://debajmecrm.com/2014/12/01/using-quick-view-form-in-crm-2013-to-show-filtered-set-of-related-records/.

It worked great and a great advantage was people could even add activities to the account from the contact form only using the ‘Add New’ button of the sub-grid in the quick view form.

 

However recently, I received multiple queries on my blog about not being able to add new record from the sub-grid in quick view form. One common thing that I noticed is that all of them are on CRM 2016. Honestly I did not notice this at first sight. However I tried this myself and unfortunately I faced the same error.

image

 

As you can see there is no ‘+’ icon in the sub-grid. Checked the quick view configuration and all. Everything seemed fine. I had one CRM 2015 on-premise version. Checked and it was working fine in that environment.

So what has been change in the form rendering between 2015 and 2016 version and suddenly remembered that CRM introduced turbo forms in Dynamics CRM for improved performance during form load in the 2015 Online Update 1.

So I just went to Settings –>Administration –> System Settings and turned on – ‘Legacy form rendering’.

image

Now when I refreshed CRM Contact form again, I could see the ‘+’ icon back. Surprised? Yes even I was.

image

This is giving a big headache to many and I keep receiving questions about whether it is a bug. Looks like it is. Specially for customers who have upgraded from CRM 2015 to 2016, they could suddenly find this functionality not working and its kind of annoying and it is very hard for consultants to explain that something OOB is not working after upgrade

I suggested this workaround for some, however as expected this is not a very viable solution to propose to the customer. A significant performance degradation has been observed by consultants for forms with lot of controls and scripts in legacy form rendering and many consultants promised a better performance to their clients after upgrade with the new turbo forms feature.

 

I am open to suggestions here and would like to know if this is a bug? Or in case I have missed some documentations by Microsoft which highlights this point.

 

Hope this helps!

Integrate Social channels other than Facebook and Twitter to automatically create record in Dynamics CRM

The world ‘social’ has become so trendy these days that just the term makes any subject interesting. And CRM being an application with Myriad of possibilities, it cannot escape itself from the social media integration as well.

So here was my customer embracing the integration of dynamics CRM with Social listening. They were amazed by the feature of creating a record in CRM dynamically from the Social listening window. However the problem is CRM social listening allows you to create records from Facebook and twitter only. And here they were interested in some other social channel.

And yes we did it. And since there are very less blogs on this which describes the custom integration end-end, I thought of penning it down step by step. Since I cannot copy-paste the entire code for my customer here, I would take an example here to explain the whole scenario.

  • The first step is to go in CRM and add the Social Channel integration you are looking for. By default, Facebook and Twitter is already there. I will add ‘Custom Channel’ as well.
    • Go to customizations –> Social Activity –> Fields
    • Open the field with schema name – “community”.
    • image
    • Click on Edit and add the new social channel. I added ‘custom channel. Note the value of optionset item. You will need this. For myself, I have given it a value of “4”.
  • The next step is to create a Social Profile for Social Channel. However every social profile need to be associated with a contact or an account in CRM. So first I will go ahead and create a contact in Dynamics CRM for the LinkedIn social profile.

image

  • Now we have to create the social profile in Dynamics CRM. Unfortunately we cannot create the social profile through UI. Below is the sample code to create a social profile associated to a contact.

var socialProfile = new Entity("socialprofile");
socialProfile["community"] = new OptionSetValue(4);
socialProfile["profilename"] = "Social Profile for Custom Social Channel";
socialProfile["customerid"] = new EntityReference("contact", Guid.Parse("BFCDE148-1306-E611-80E2-6C3BE5A8B1D0"));

crmService.Create(socialProfile);

The guid in the above is the guid of the contact we created just before. And community field has value of 4 which is what we created for Custom Social Channel.

So you are all set. Now the next obvious step is to create the social activity record. Not so fast! There is one big step missing and that is the ‘Automatic record creation and update rules’ set-up. This step is to basically tell CRM what to do when a social activity of type of Custom Social Channel is getting created.

  • Go to Settings –> Service Management –> Automatic Record Creation and Update Rules

image

  • Create a new rule. Off-course you will give a different name and stuffs to this.

image

  • Notice carefully the screenshot above. There is a lookup for additional properties. This is the most important part. I have created a record named ‘Custom Channel Properties’ and associated here. Below is the screenshot for the record.

image

Notice the Channel properties sub-grid in the above screenshot. You have to define only those properties here which would come from the json feed from the social channel you have chosen. The property names should be exact match. Please note that for an example here, I would create a contact record from the social channel feed. So I have defined three properties firstname, lastname and emailaddress

The next step is to specify when this rule will take effect and what it should do. For this we have to specify the record creation and update Details. Add a new record to the sub-grid as shown in the below screenshot.

image

Here I specified that if the source of this activity is my custom channel then create a contact record. The contact record fields are populated from the channel properties that we defined earlier.

image

Save and close and activate the rule. All set and done. Now the last step is to create the social activity record.

Here I will not demo the code to get the JSON from the social channel you are integrating with because it depends on the API of the respective social channel. I will assume that you have got the json feed. With that I will show the sample code below to create a social activity.

var ent = new Entity("socialactivity");
           ent["activityadditionalparams"] = "{firstname: \"Social\", lastname: \"Contact\", emailaddress:\"social@linkedin.com\"}";
           ent["subject"] = "From Social channel";
           ent["community"] = new OptionSetValue(4);
           ent["postfromprofileid"] = new EntityReference("socialprofile", Guid.Parse("0B994E58-0206-E611-80E2-6C3BE5A83B1C"));

           service.Create(ent);

The most important line in the above code is highlighted in bold. Here we are passing the json feed in a special field of social activity record called ‘activityadditionalparams’. Notice that I mentioned the same json properties that I specified in the channel properties. CRM will do the task for you to map it from the json output to the channel properties.

And voila! Once I run the above code, I go to my contacts list and can see the contact created.

Hope this helps!

{KnowHow} How to show all related contacts in entire customer hierarchy in Dynamics CRM 2015 onwards

Recently my friend called up for a requirement where they needed to show all contacts in customer hierarchy. Let me explain the scenario here before moving further

Suppose Account A is parent customer for Account B and Account B is the parent customer for Account C.

So the requirement is when Account A form is loaded, a sub-grid should on the form should show all the contacts of Account A + Account B + Account C. If Account B is loaded then the sub-grid should show all the contacts of Account B + Account C.

Let us approach the solution here. Ideally it is a two step solution.

Step 1 – Prepare the fetchxml which would allow us to fetch all the contacts in the entire customer hierarchy.

Step 2 – Bind the fetchxml to the sub-grid at run time to show the contacts.

Now for the first part, CRM 2015 introduces the new ‘under’ operator which eases out our task like anything. After some discussion, my friend came up with a perfect fetchxml to achieve this. For e.g the following is the fetchxml to show all the contacts in the hierarchy of ‘Account A’.

image

 

Wonderful isn’t it. It just gives you the results you want for this. With 2013 and prior versions you can imagine how much you would need to code to achieve the same.

So we have the fetchxml. Now coming to step 2 which is to bind the fetchxml dynamically to the grid.

For 2015, there is already a wonderful blog which explains this – https://joshimandarblog.wordpress.com/2015/02/04/crm-2015-applying-custom-fetchxml-to-a-subgrid-using-javascript/

As much as we learn new concepts, I think the best thing is to see them in action in real life and my genius friend hit the bulls eye on this. He is a very well know face in Dynamics CRM – Nishant Rana.

This above logic would work not only for customer – contact relationship but in other areas of hierarchy as well like finding all users in a reporting hierarchy.

Hope this helps!

{Useful To Know} What role privilege controls System Setting visibility in Dynamics CRM?

Recently I came across a question in Dynamics Forum where the same question was posted. To be more specific, some sales user in the environment were having access to ‘System Settings’ in the administration section due to improper set-up of security role.

Clearly this was a security vulnerability. So what is the privilege that gives you access to the System Settings of the administration section.

To be honest, when I saw this question in the forum, I was not sure exactly sure about what is the exact privileged that needs to be turned on or off. However I knew that all the system settings are organization specific and hence they should be stored in some entity while relates to Organization settings.

I just browsed the security role form and voila! In the Business Management section, I could find the ‘Organization’. If we provide write privilege for this entity for a security role, user with the security role would be able to see ‘System Settings’ in the administration section. Check for the screenshot below.

image

Small info. But if you are not aware of it, can eat up your significant amount of time.

 

Hope this helps!