Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM forum
Unanswered

Hiding Export to Excel Button on Account Entity even when a record is selected

Posted on by 30
 Dear Community,
 
I've been try to hide 'Export to Excel' button on Account Entity for some users. That user shouldn't have access to export to excel only on Account Entity.
Export to Excel is hiding ok for the HomePageGrid.
but if the user is selected one or more record, it is showing again.
 
Is there a way to hide 'Export to Excel' even when a record is selected?
I've been tried SelectedControlSelectedItemCount on CRM parameter but no luck.
 
Here is my code.
function getCurrentUserSecurityRole_CustomerAccess()
{
    debugger;
    var value=true;
    var userRoles=Xrm.Utility.getGlobalContext().userSettings;
    if(Object.keys(userRoles.roles._collection).length>0)
    {
        for ( var rolidcollection in userRoles.roles._collection)
        {
           var currentUserRoles= Xrm.Utility.getGlobalContext().userSettings.roles._collection[rolidcollection].id;    
//if user doesn't have access to 'Export to Excel' for Account Entity
           if(currentUserRoles.toLowerCase()==/8d1657c6-3e21-ee11-9cbe-6045bd57c806/)
           {
               value=false;
               break;
           }
        }
    }
    return value; 
}
 
 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,558 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,647 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans