Reply
Trusted Contributor
rov
Posts: 336
Accepted Solution

passing record id

I have created a HTML email template that gets triggerd when a record is sent for Approval. Within this email template I have a link 'Approve/Reject' which takes the Approver to the Force Site wherein the landing page is a visualforce page.
 
The visualforce page loads correctly but without any data.

How can I get the correct record to load? (This page displays the record details when tested outside of Force Site. )

 

extension class

public class JobApp {

public Id posId    {get;set;}
private final Position__c pos;
public JobApp(ApexPages.StandardController controller)

{

 posId = controller.getRecord().Id;  
 
}
public PageReference saveAndReject() {

PageReference requestPage = new pagereference('https://na9.salesforce.com/'+posid);
requestPage.setRedirect(true);
return requestPage;
}
}

 

VisualForcePage

<apex:page standardController="Position__c" extensions="JobApp" showHeader="false" >

<apex:form >
<apex:pageBlock >
    <apex:pageBlockSection >
    
    <apex:sectionHeader title="Position Detail Page" /> 
    </apex:pageBlockSection> <br/>
    
    <b>  &nbsp;&nbsp;
         <apex:OutputLabel value="Your approval has been requested for the following New Position."> 
         </apex:OutputLabel>
    </b>
      
   
    Position Record: {!Position__c.Name} <br/><br/>    
    Status: {!Position__c.Status__c} <br/><br/>
    Location: {!Position__c.Location__c}<br/><br/>    
    Functional Area: {!Position__c.Functional_Area__c}<br/><br/>    
    Job Level: {!Position__c.Job_Level__c}<br/><br/>    
    Minimum Salary: {!Position__c.Min_Pay__c}
    Maximum Salary: {!Position__c.Max_Pay__c}
    
    <br/><br/><br/><br/><br/><br/>
        
    <apex:OutputLabel value="Please Click the appropriate button below to approve or reject the request."> 
    </apex:OutputLabel> <br/><br/>
    
    &nbsp;&nbsp;&nbsp;
           
    <apex:commandButton action="{!saveAndReject}" styleClass="buttonStyle" style="vertical-align:left;width:80px;height:20px;background:green;" value="Approve" />        
    
    <apex:commandButton styleClass="buttonStyle" style="vertical-align:left;width:80px;height:20px;background:red;" value="Reject" />
              
    <br/><br/> 
   
</apex:pageBlock>
</apex:form>
</apex:page>

 

 

Regular Contributor
cloudmania
Posts: 111

Re: passing record id

Check the site guest user profile access for ur custom object...

Make sure that it has sufficient permission.

Erkan ÇİPİL
SFDC Consultant & Software Engineer & Mathematician
Trusted Contributor
rov
Posts: 336

Re: passing record id

Erkan, thanks for your response.

 

I have the required permissions for the guest user profile. I will check again though.

Trusted Contributor
rov
Posts: 336

Re: passing record id

Sorry for the late response. But I got this working (with th help of Salesforce Support). All I had to do was, in the link, pass the recordid. As in

 

 

http://rov.universal.na9.force.com/VFP/{!customobject__c.Id}

 

where !customobject__c.Id = recordid