+ Start a Discussion

Custom Button issue



   I'm somewhat new to VF and am running into a very simple (i assume) issue.  I have created a custom object Member Profile that has a master detail relationship with contacts.


I wrote a trigger that creates a new profile each time a new contact is created, and made sure each contact can have 1 and only 1 profile.


Right now the profile is shown in a related list on the contact page.  I want to create a button that brings the user to the detail page of the member profile.


I created a very simple VF member_profile page here



<apex:page standardController="Member_Profile__c">

<apex:detail relatedList="false"/>



Then I added a custom button to the contacts page simply directing to a URL of....





but when I click on the button, it brings me to a new page and gives me this error


Insufficient Privileges
You do not have the level of access necessary to perform the operation you requested. Please contact the owner of the record or your administrator if access is necessary. 


But if I look at the URL, it doesnt have the id of the member profile, it has the name of the profie.  If i try to add the .id like below




It tells me that that field doesnt exist.


I'm sure that I'm doing something simple and stupid, but its driving me crazy that I can't figure it out.  It seems like such a simple thing to want to have a button navigate to another objects detail page.  PLEASE HELP














Hi Chris,


1. For using Id field, user the relationship notation -



2. This seems to be permissions issue. Is the member profile object  / record has sufficient permissions to be accessed by the user you are trying with. Please check the object level permissions and sharing settings of the object / record. Also try with a System Admin account, to verify if this actually a permissions issue.


hope this helps.






I have made similar kind of thing in which I have showed all the contact associated with a particular account inside the pageblocktable and whenever we click on particular contact name it will automatically redirect me to that contact.


Try the below code as reference:

<apex:page standardController="Account">
<apex:pageBlock id="ContactDetail" >
<apex:pageBlockTable value="{!Account.contacts}" var="c" >
<apex:column >
<apex:facet name="header">Account Name
</apex:facet><apex:outputLink value="/{!c.Id}"> {!c.lastName}</apex:outputLink>


Note:Call the page by passing the id of any account in Url like this:


Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved. 


Thank you for the quick response


I tried to uset he relationship notation (__r), but I still get the error saying the field does not exist.  If I go to the Member profile custom field page I can see that the Contact field (masyer-detail relationship), lists the Child relationship name as


Master-Detail Options
Related ToContactChild Relationship NameMember_Profiles
Related List LabelMember Profiles
Sharing SettingRead/Write. Allows users with at least Read/Write access to the Master record to create, edit, or delete related Detail records.



But if I try to edit my URL in my custom button to any combination of things using this member_profiles__r.Id, I keep getting the same error.  I just don't get it.






Is this happening becasue I am trying to go Parent to Child sonce I am on the Contact page, and trying to find the child data?  I know from what I have found in other boards that Parent to Child queries differ from Child to Parent, but I'm not sure if that applies here or not.


This should be so simple and yet I just can;t get it to work.  Any help is appreciated.