1
votes

I'm new to Salesforce/Apex and I need to be able to test a component I am working on in a separate page.

Here is the scenario. I have the following test page:

 <apex:page sidebar="false" showHeader="false" standardController="Contact">
   <div id="wrapper" style="max-width:980px;">
       <c:djEmailTemplate_MainComponent sObject="{!Contact}" theContactId="{!Contact.Id}"/>
   </div>
 </apex:page>

I can display the page by adding /apex/testpage to the url after the project name. What I don't know how to do is to include data to satisfy the parameters (sObject, theContactId) that are needed to populate values in the component.

Can anyone explain how I can do this?

Thanks in advance.

1

1 Answers

0
votes

Your test page uses the Contact object as its standard controller, so in most cases you would want to specify a Contact record for the page/controller to operate on. You can use any existing Contact record in your org, or create a new one (specifically you'll want to grab the ID of the record) and then append the ID to the URL you're using like so: /apex/testpage?id=003xxxxxxxxxxxx. This will provide the page and controller a record to pass to the VF component.