Remove Entity from Advanced Find without removing users access via security role

Remove Entity from Advanced Find without removing users access via security role

 

If you want to remove users access to an entity as well as from AdvancedFind, you should manipulate the security role and remove the access altogether

But if you just want to remove the entity from the AdvancedFind and still want users to access the entity from the CRM’s other areas like main menu and from related entities, you should be able to do this using the SDK.

Microsft Dynamics CRM has a  Boolean property “IsValidForAdvancedFind” in EntityMetadata to detect which entity should appear in Advanced Find.

EntityMetadata.IsValidForAdvancedFind Property – Gets or sets whether the entity is will be shown in Advanced Find.
AttributeMetadata.IsValidForAdvancedFind Property – Gets or sets the property that determines whether the attribute appears in Advanced Find.

The following query hides ‘contact’ entity from Advanced Find.

update MetadataSchema.Entity set IsValidForAdvancedFind = 0 where Name = contact

update MetadataSchema.Relationship set IsValidForAdvancedFind = 0
where ReferencingEntityId = (select MetadataSchema.Entity.EntityId from MetadataSchema.Entity where Name = contact)
and IsValidForAdvancedFind  = 1

You will need to Reset IIS and clear server and client cache for it to take effect.

1,075 total views, 1 views today

About Author

Ricky Saini

Ricky Saini
Dynamics CRM, SharePoint, Office 365, Windows Azure and .Net Architect/Consultant/Freelancer in Australia ( Melbourne, Sydney and Canberra)

Leave a Comment