Clash Royale CLAN TAG#URR8PPP
Dynamics CRM 2016 modify list of activities views
I am very new to MS Dynamics. I am using dynamics CRM 2016 and I need to remove, in the activities page, the views about entities that I am not using such as Campaign Response, Campaign Activity, etc.
I do not see them in the list of views of the Activity entity in my solution, so I cannot remove them from there, am I missing something? Is there a way to remove those views?
2 Answers
2
Unfortunately you cannot hide/remove those.
Reason: They are not usual views, they are part of System tailored Activity entity family (Activity, Activity Pointer, Activity Party, Custom Activity types, etc).
If you see any Activity entity properties, the checkbox 'Display in Activity Menus' is checked & disabled. This settings is being used for navigation, views, filters, etc.
Even while creating custom activity, this option is enabled & if you forget to check it, that particular Custom Activity type will be hidden from everywhere wherever you are using its siblings (Email, Fax, etc)
If its unchecked, Even Associated view will not be showing this activity under it's regarding Parent record, which is failing the main reason why we are using CRM & activity relationship.
In a nutshell, this setting once enabled, cannot be undone. The activity cannot be distinguished/disabled using security role, because all are of same bucket.
Maybe you can try some unsupported customizations using DOM explorer in javascript & hide it, which I don't recommend. Power objects blog talk about renaming it to something to avoid users using it & other options.
There is a solution but it's not ideal. There is a supported way to intercept the fetch of views and remove those you don't want. Below is the plugin.
It's not ideal because it can affect performance. Also, if you are new to dynamics coding a plugin will be difficult for you.
namespace Xrm.Plugins.Sandbox.SavedQuery
{
using Microsoft.Xrm.Sdk;
using Microsoft.Xrm.Sdk.Query;
using System;
using System.Linq;
public class PostSavedQuery : Plugin
{
public PostSavedQuery()
: base(typeof(PostSavedQuery))
{
base.RegisteredEvents.Add(new Tuple<int, string, string, Action<LocalPluginContext>>(40, "RetrieveMultiple", "savedquery", new Action<LocalPluginContext>(ExecutePostSavedQuery)));
}
protected void ExecutePostSavedQuery(LocalPluginContext localContext)
{
if (!localContext.PluginExecutionContext.InputParameters.Contains("Query") || !(localContext.PluginExecutionContext.InputParameters["Query"] is QueryExpression))
{
return;
}
EntityCollection entityList = (EntityCollection)localContext.PluginExecutionContext.OutputParameters["BusinessEntityCollection"];
var result = new EntityCollection();
result.Entities.AddRange(entityList.Entities.Where(x => x.Attributes.Contains("name")
&& !(x.Attributes["name"].ToString().ToLower().StartsWith("view:") )
)
);
result.Entities.AddRange(entityList.Entities.Where(x => !x.Attributes.Contains("name")));
localContext.PluginExecutionContext.OutputParameters["BusinessEntityCollection"] = result;
}
}
}
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
I don't get why we cannot remove them, this is very confusing for the end users when their business has nothing to do with that kind of activities, but anyways, thank you for your reply.
– rox
Dec 12 '17 at 20:08