function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
CmFCmF 

Need to remove account View Hierarchy link

We are using a partner portal.  We need to remove the View Hierarchy link from the account page.  It shows all accounts, not just the accounts the partner owns.  (It isn't the sharing rules, everything is private so if they click on an account it says Insufficient Privileges).  I only want to remove the hierarchy link from the partner view, not all views so we need to take the profile into consideration.

 

I've created a vf page that works, but how do I override the standard View of accounts for just 1 profile?

 

Does any one have any suggestions?  I am desperate!

Best Answer chosen by Admin (Salesforce Developers) 
CmFCmF

Thanks so much.  I have been playing with this for 2 months.  Here are my vf page and controller in case someone else can use it.

<apex:page standardController="account" extensions="overrideAcctView" action="{!doRedirect}">
  <apex:form >  Still here on OverrideAcctView.  Didn't redirect. </apex:form>
</apex:page>
 

public class overrideAcctView {String recordId;

public overrideAcctView(ApexPages.StandardController controller)

    {recordId = controller.getId();}

public PageReference doRedirect()

{  Profile p =

    [SELECT name from Profile where id = :UserInfo.getProfileId()];

    if (p.name == 'Custom-PartnerUser')

    {   PageReference customPage = Page.PartnerAcctView;

        customPage.setRedirect(true);

        customPage.getParameters().put('id', recordId);

        return customPage; }   

    else

    {   PageReference stndPage = Page.stndAcctView;

        stndPage.setRedirect(true);

        stndPage.getParameters().put('id', recordId);

        return stndPage;    }

}  }

 

 

All Answers

sabamonasabamona

I believe that you have created a VF page .

Now you need to display it just for one profile.. right??

If this is the case, one of the workarounds (not a very good one, but works) is to display an intermediate VF page which overrides the Accounts view, in case of the specifc profile, redirect it to your VF page, otherwise to the standard page :)

CmFCmF

Thanks so much.  I have been playing with this for 2 months.  Here are my vf page and controller in case someone else can use it.

<apex:page standardController="account" extensions="overrideAcctView" action="{!doRedirect}">
  <apex:form >  Still here on OverrideAcctView.  Didn't redirect. </apex:form>
</apex:page>
 

public class overrideAcctView {String recordId;

public overrideAcctView(ApexPages.StandardController controller)

    {recordId = controller.getId();}

public PageReference doRedirect()

{  Profile p =

    [SELECT name from Profile where id = :UserInfo.getProfileId()];

    if (p.name == 'Custom-PartnerUser')

    {   PageReference customPage = Page.PartnerAcctView;

        customPage.setRedirect(true);

        customPage.getParameters().put('id', recordId);

        return customPage; }   

    else

    {   PageReference stndPage = Page.stndAcctView;

        stndPage.setRedirect(true);

        stndPage.getParameters().put('id', recordId);

        return stndPage;    }

}  }

 

 

This was selected as the best answer
Sulabh KapoorSulabh Kapoor

You can use a side bar component wherein you can write your javascript code to either hide or override the link. Add that component on the home page.