This solution gives record access to a Salesforce user
via email approval. Here we are providing access to the
Accounts but this can be generalized for any standard or custom object.
In order to grant
access to the Account, an approval workflow request would be sent to the record
owner and upon approval Apex code would be executed to add the requested user
in the Account Team/Share objects.
1 1. Provide a Request for Access button against each
Account record on the Visual force page.
a. Display a pop-up to the end user: A Request Email has been sent for Access.
b. Create a Custom Object “Account Sharing Request” and add an Entry in this object:
AccountID, OwnerID, RequestedBy(UserID),IsApproved(False) for the request.
2. Create an Approval process for Account Sharing Request in the controller class and send an approval request email to the record owner.
3. Enable email approval response so that the user can approve or reject the request by replying to the email: approve, approved, yes, reject, rejected, or no.
4. Update IsApproved field to True upon approval: This is the Final approval action.
5. Update trigger on the Account_Sharing_Request__c object would add the requested User to the Account Team and Account share Object.
a. Display a pop-up to the end user: A Request Email has been sent for Access.
b. Create a Custom Object “Account Sharing Request” and add an Entry in this object:
AccountID, OwnerID, RequestedBy(UserID),IsApproved(False) for the request.
2. Create an Approval process for Account Sharing Request in the controller class and send an approval request email to the record owner.
3. Enable email approval response so that the user can approve or reject the request by replying to the email: approve, approved, yes, reject, rejected, or no.
4. Update IsApproved field to True upon approval: This is the Final approval action.
5. Update trigger on the Account_Sharing_Request__c object would add the requested User to the Account Team and Account share Object.