• teja swi 10
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 6
    Replies
====>>>>> My vfpage <<<<======


<apex:page controller="aaaa"> <script> function fun121(id,inputid) { document.getElementById(inputid).value = id; alert('hi'+id); return true; } </script> <apex:form > <apex:pageBlock > <apex:pageBlockSection title="New Lead"> <!-- ---------------------------------------------------------------------- --> <!-- NOTE: Please add the following <META> element to your page <HEAD>. --> <!-- If necessary, please modify the charset parameter to specify the --> <!-- character set of your HTML page. --> <!-- ---------------------------------------------------------------------- --> <META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=UTF-8"> <!-- ---------------------------------------------------------------------- --> <!-- NOTE: Please add the following <FORM> element to your page. --> <!-- ---------------------------------------------------------------------- --> <form action="https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8" method="POST"> <input type="hidden" name="oid" value="00D28000000dlOU"/> <input type="hidden" name="retURL" value="http://www.google.com"/> <!-- ---------------------------------------------------------------------- --> <!-- NOTE: These fields are optional debugging elements. Please uncomment --> <!-- these lines if you wish to test in debug mode. --> <!-- <input type="hidden" name="debug" value=1> --> <!-- <input type="hidden" name="debugEmail" --> <!-- value="teja.gujjula@gmail.com"> --> <!-- ---------------------------------------------------------------------- --> <label for="first_name">First Name :</label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input id="first_name" maxlength="40" name="first_name" size="20" type="text" /><br/> <label for="last_name">Last Name :</label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input id="last_name" maxlength="80" name="last_name" size="20" type="text" /><br/> <label for="email">Email :</label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input id="email" maxlength="80" name="email" size="20" type="text" /><br/> <label for="company">Company :</label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input id="company" maxlength="40" name="company" size="20" type="text" /><br/> <label for="city">City :</label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input id="city" maxlength="40" name="city" size="20" type="text" /><br/> <label for="state">State/Province</label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input id="state" maxlength="20" name="state" size="20" type="text" /><br/> <input type="submit" name="submit"/> </form> </meta> </apex:pageBlockSection> <apex:pageBlockSection title="Lead Records" columns="1"> <apex:pageblockTable value="{!ldlist}" var="a"> <apex:column headerValue="First Name" value="{!a.FirstName}"/> <apex:column headerValue="Last Name" value="{!a.LastName}"/> <apex:column headerValue="E-mail" value="{!a.Email}"/> <apex:column headerValue="Company" value="{!a.Company}"/> <apex:column headerValue="City" value="{!a.city}"/> <apex:column headerValue="State" value="{!a.state }"/> <apex:column > <apex:commandLink value="Edit" action="{!leadedit}" onclick="fun121('{!a.id}','oid')" style="font-family:verdana" immediate="true"/> </apex:column> </apex:pageBLockTable> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page>






======>>>>> Controller  <<<<<======

public with sharing class aaaa
{
  public Lead ld{get;set;}
  public List<Lead> ldlist{get;set;}
  
   
  public aaaa()
  { 
      ldlist=[select FirstName,LastName,Email,Company,city,state from Lead];
   
   }
   
     public void leadedit()
           {    
             
              String ownid=System.currentPageReference().getParameters().get('oid');
              System.debug('ownerrrr'+ownid);
              ld = [select FirstName,LastName,Email,Company,city,state from Lead  where id =:ownid limit 1];
           }
 }
 
This is my code ....  I created a button in Vf when i click on that button my page should convert in to pdf and send a mail with that pdf for that i have written below code ... but my problem is how can i give values to the page , my page name is Stre 
  public void sendpdf()
          {
           string cname = ApexPages.currentPage().getParameters().get('pId');
           string dname = ApexPages.currentPage().getParameters().get('cId');
           string ename = ApexPages.currentPage().getParameters().get('chId');
           string fname = ApexPages.currentPage().getParameters().get('chstnum');
           string gname = ApexPages.currentPage().getParameters().get('chendnum');
           string hname = ApexPages.currentPage().getParameters().get('commamount');  
          string iname = ApexPages.currentPage().getParameters().get('pcreated');      
           string jname = ApexPages.currentPage().getParameters().get('pcfailed');      
           string kname = ApexPages.currentPage().getParameters().get('totalcom');      
              Messaging.SingleEmailMessage email1=new Messaging.SingleEmailMessage();
              String[] toadd=new string[]{'teja.sfdc99@gmail.com'};
              email1.setToAddresses(toadd);
              pageReference p=page.Stre;
              Blob b=p.getContentAsPdf();
              Messaging.EmailFileAttachment ef=new  Messaging.EmailFileAttachment();
              ef.SetFileName('Check Run PDF');
              ef.SetBody(b);
              Messaging.EmailFileAttachment[] attachments=new  Messaging.EmailFileAttachment[]{ef};
              email1.setFileAttachments(attachments);
              email1.setSubject('PDF Attachment');
              email1.SetPlainTextBody('This is sample test PDF');
              Messaging.Email[] emails=new Messaging.Email[]{email1};
              Messaging.SendEmail(emails);
              
              }

sample page with parametes is https://c.cs1.visual.force.com/apex/Stre?pId=Phoenix%20Health%20Plans%20(Formerly%20Abrazo)&cId=14/03/2015&chId=369175.0&chstnum=22912&chendnum=22949&commamount=369175.0&pcreated=3240&pcfailed=399&totalcom=4324

how can i pass this in my code please tell me i have taken the values as strings in the code but how can i pass it in pageReference p=page.Stre?.......


please help me with this 

 

 
This is my code ....  I created a button in Vf when i click on that button my page should convert in to pdf and send a mail with that pdf for that i have written below code ... but my problem is how can i give values to the page , my page name is Stre 
  public void sendpdf()
          {
           string cname = ApexPages.currentPage().getParameters().get('pId');
           string dname = ApexPages.currentPage().getParameters().get('cId');
           string ename = ApexPages.currentPage().getParameters().get('chId');
           string fname = ApexPages.currentPage().getParameters().get('chstnum');
           string gname = ApexPages.currentPage().getParameters().get('chendnum');
           string hname = ApexPages.currentPage().getParameters().get('commamount');  
          string iname = ApexPages.currentPage().getParameters().get('pcreated');      
           string jname = ApexPages.currentPage().getParameters().get('pcfailed');      
           string kname = ApexPages.currentPage().getParameters().get('totalcom');      
              Messaging.SingleEmailMessage email1=new Messaging.SingleEmailMessage();
              String[] toadd=new string[]{'teja.sfdc99@gmail.com'};
              email1.setToAddresses(toadd);
              pageReference p=page.Stre;
              Blob b=p.getContentAsPdf();
              Messaging.EmailFileAttachment ef=new  Messaging.EmailFileAttachment();
              ef.SetFileName('Check Run PDF');
              ef.SetBody(b);
              Messaging.EmailFileAttachment[] attachments=new  Messaging.EmailFileAttachment[]{ef};
              email1.setFileAttachments(attachments);
              email1.setSubject('PDF Attachment');
              email1.SetPlainTextBody('This is sample test PDF');
              Messaging.Email[] emails=new Messaging.Email[]{email1};
              Messaging.SendEmail(emails);
              
              }

sample page with parametes is https://c.cs1.visual.force.com/apex/Stre?pId=Phoenix%20Health%20Plans%20(Formerly%20Abrazo)&cId=14/03/2015&chId=369175.0&chstnum=22912&chendnum=22949&commamount=369175.0&pcreated=3240&pcfailed=399&totalcom=4324

how can i pass this in my code please tell me i have taken the values as strings in the code but how can i pass it in pageReference p=page.Stre?.......


please help me with this