+ Start a Discussion

Inserting project in controller and using that Id in VF template

Hello Friends,


I am using a visualforce template, in that template I am using a custom component and a controller.


In controller I am trying to insert a project and want to use it's Id in anchor tag of visualforce template.


here's the code,


class test


       public string ProjectId {get; set;}


        public void Init()


             Project project = new Project();

             project.name = 'testProject';


             insert project;

             ProjectId = project.Id;




<messaging:emailTemplate subject="Mutual Interest for" recipientType="User" relatedToType="Contact">
<messaging:htmlEmailBody >

<c: testComponent />

<a href="https://testSites.force.com?Id= here I want to use project Id" >click </a>



Can anybody help me to get through this.


Thanks and Regards,


Rahul SharmaRahul Sharma

Try using merge fields over there.