What I want to achieve
I want to be able have my high volume customer portal users access their own contact record or contacts related to the account linked to them. I want to make this work by redirecting the user to the edit page of their contact record from the portal. So, in the apex code below you will see I am redirecting the user to the edit URL.
What I have tried
I wrote a visualforce page with an edit button which basically redirects the user to the edit page of their contact record. I receive an error here which is listed at the bottom!
Apex Code
public PageReference EditProfile(){
//contactId is the id of the user's contact record
PageReference redirect = new PageReference('/'+contactId+'/e');
return redirect;
}
Query Results
//I ran the following query and got the results pasted below
UserRecordAccess access = [select RecordId, HasEditAccess from UserRecordAccess where UserId = :UserInfo.getUserId() and RecordId =: contactId];
//Results show that the user has edit access on the record
13:48:35.091 (91988000)|USER_DEBUG|[27]|DEBUG|UserRecordAccess:{RecordId=003i000000D7AYPAA3, Id=000000000000000AAA, HasEditAccess=true}
Configuration
1. Added 2 permission sets which gave the user read edit and create access on Account and Contact Object.
2. Under Organization-Wide Defaults I made the Account and Contact settings 'Public Read/Write'
But still, I am unable to make this work. I don't want to be writing the whole page in visualforce. Could you help me identify if I am missing something?
Error Received
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.