function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Jean-Se DoraisJean-Se Dorais 

Apex embedded into a VF page

Hello,

I've pieced together some code and at a step where I need a little help.

I've got the following class that retrieves the current Lead Id (this will be launched via a button on the lead object):
public class CurrentRecordIdDemoController{
public String currentRecordId {get;set;}
public String parameterValue {get;set;}
public Lead lead{get;set;}
 
    public CurrentRecordIdDemoController(ApexPages.StandardController controller) {
        currentRecordId  = ApexPages.CurrentPage().getparameters().get('id');
        lead = [Select Id, Name, Email, Company from Lead where Id =: currentRecordId ];
        parameterValue = ApexPages.CurrentPage().getparameters().get('nameParam');
    }
}
...and the following VF page:
<apex:page standardController="Lead" extensions="CurrentRecordIdDemoController">

String data = {!currentRecordId};
Blob mac = Crypto.generateMac('HMacSHA256', Blob.valueOf(data), Blob.valueOf('ABC123'));
String sig = EncodingUtil.urlEncode(EncodingUtil.base64Encode(mac), 'UTF-8');
String url = 'https://mysite.com/4945922?lid={!currentRecordId}&amp;signature=' + sig;

  <apex:form >
    <apex:pageBlock >
        <apex:pageBlockSection title="Current lead record Id is : {!currentRecordId}" collapsible="false">
            <apex:outputField value="{!lead.Name}"/>
            <apex:outputField value="{!lead.Email}"/>
            <apex:outputField value="{!lead.Company}"/>
        </apex:pageBlockSection>

         
    </apex:pageBlock>
  </apex:form>
</apex:page>
I would like the String url to be displayed in the <apex:form> section but unsure how to do so.

The code above <apex:form> needs to be reformated as I'm currently getting the following output:

Current output
How would one reformat the Visualforce page code to achieve this?

Thank you!

 
mukesh guptamukesh gupta
Hi Jean,

Please follow below refference:-

<apex:outputLink value="https://www.salesforce.com" id="theLink">www.salesforce.com</apex:outputLink>

if you need any assistanse, Please let me know!!

Kindly mark my solution as the best answer if it helps you.

Thanks
Mukesh