I have one apex class somehow i need to populate a link. That link should be open records detail page.

This is what i've given in Email Templete. Whenever i send a mail through this Templete i can see a link in email that is opening Record's page. Same like i need it in Apex class.

Please review the FCPA changes for {!Question_Answer__c.Account__c}. {!Question_Answer__c.Link}

enter image description here

This mail is generated by email template. Same like i need it through That class


you can do this easily in Apex. create Pagereference method

public pagereference redirectUser()
    return new pagereference('/'+recid);

and call this method and it will redirect to record detail page. You can do something like

String Recordlink = URL.getSalesforceBaseUrl().toExternalForm()+'/'+RecordId;

and this a same link which you are getting in email. You can display it on VF page or pass it to any other method.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy