• SF Dakshendra
  • NEWBIE
  • 25 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 1
    Likes Given
  • 38
    Questions
  • 17
    Replies
Hi,
Site page is not redirected to another custom page after click on Custom button in source page.
here is my code---  
pagereference pr=new pagereference('/apex/Thankyou');
pr.setredirect(true);           
return pr;
Please find a solution asap.
Thanks,
User-added image
 
Hi

Canvas Signature Type is not Supported in Android Mobile ,so how can i overcome Problem ?

Thanks
Dakshendra
Hi
How to create visual force email template for below html template?


Dear {!Lead.FirstName}:
 
It was a pleasure spending time with you yesterday and today.
 
At one, we enjoy contributing to the continued success of progressive companies like {!Account.Name}. I look forward to continuing our dialogues and will be in touch regarding our discussion. In the mean time, if you have any additional questions, please do not hesitate to contact me directly.
 
Sincerely,
{!User.Name}
{!User.Phone}
{!User.Email}

 
Hi
User-added image
In th above picture if i entered a name "Suresh" in a text box field automatically it takes signature type box like above image.
and also when i click on on button "different font style signature" it shows different styles for signature like below image.How can i get that requirement using visual page code.
User-added image
Hi

if i enter a text in text box i need that text into a signature style box with different font styles how to design a visual page for that?




here my code is




<apex:page controller="generate" pageStyle="vertic" renderAs="pdf" >

<APEX:FOrm >
 


 Opportunity Name:{!opp.name} <br/>
<apex:pageblock >
        
            <table width="100%" border="0" >
                <tr>
                    
                    <td width="28%"><apex:image url="{!$Resource.google}"/></td>
                   
                     
                    <td width="5%"> </td>
                    <td width="8%"> </td>
                    <td width="8%"> </td>
                     <td width="59%">
                        <table width="65%" align="right">
                            <tr>
                                <td width="100%" align="right" style="font-size:12pt">Estimate</td>
                            </tr>
                            <tr>
                                <td width="100%" align="center" >
                                     <table width="100%" border="1" align="right">
                                         <tr>
                                            <td width="40%" bgcolor="#127826"><center>DATE</center></td>                              
                                         </tr>
                                         <tr>
                                            <!--<td width="40%" style="text-align:center"><apex:outputField value="{!opp.Invoice_No__c}"> </apex:outputField></td>-->
                                             <td width="40%" style="text-align:center"><apex:outputtext value="{!myDate}"/></td>
                                           
                                         </tr>
                                     </table>    
                                  </td>
                              </tr>
                         </table>
                     </td>
                  </tr>
                  
                  
                 
             </table>       
          </apex:pageblock>
          
                    


    <apex:pageBlock >
        <apex:pageBlockTable value="{!fsrd}" var="fr" columnsWidth="40%,30%,30%" border="1">
            <apex:column value="{!fr.name}"/>
            <apex:column value="{!fr.Comments__c}"/>
            <apex:column value="{!fr.Opportunity__c}"/>
           
        </apex:pageBlockTable>
    </apex:pageBlock>
    
    <br>  </br>
    
   
    
    
</APEX:FOrm>
 
</apex:page>
Hi

how to integrate dot net with salesforce and brief information about dot net installation ? 
How to install dot net and instructions after installation?

Thanks
Hi

How to integrate outlook 2016 with salesforce
Hi

I create a custom button for opportunity object when i click on that it generates an attachment and that attachment name will be saved as below format 
Format is Account name:listprice__c:time format

listprice__c is product field under opportunity related list ...
for suppose if i have 2 products under opprtinty related list higher amount of listprice__c in these two products will display in attchement format for example i have 2 products under opportunity in these products 1 st product had 25 list price and 2nd product had 40 the attchemat format will be displayed like below.

Account name:40:timeformat

my code is:
   Attinvoice.Name =oppty.account.name+'_'+system.now().format('MM/dd/yyyy')+'.pdf';

 
Hi

i create a custom button it works in normal browser but it dont works in safari browser how can i get that ?
Thanks
Hi

Need apex trigger for assign pricebook to a particular opportunity record type.i have 3 opportunity record type named as bulk,partner,service and pricebooks named as hover.self and several pricebooks.

Thanks
Hi

Need apex trigger for assign pricebook to a particular opportunity record type.i have 3 opportunity record type named as bulk,partner,service and pricebooks named as hover.self and several pricebooks.

Thanks
Dakshendra.R
Hi 
How to assign opportunity record types based on  account record types using apex trigger and not for converting lead just using account and opportunity record types?

Thanks
Dakshendra.R
Hi
If i have 10 Checkboxes fields in web to lead form, If i selcet atleast 1 checkbox thats worked but if i didnt select atleast 1 checkbox i need a message "please select atleast one item" how can i get that in web to lead form?

Thanks
Dakshendra.R
HI i try this code for getting contact address information under account related list,its worked but i need the address information by only 3 coloums.if it has 4 contacts with same account the 4 th will be appeared in next row firstUser-added image colomn

Here my code is


public class getaddress

    public String obj;
    public account acc{get;set;}
    public List<contact> cons{get;set;}
    public id accid=apexpages.currentpage().getparameters().get('id'); 
     
    
    public getaddress() 
    {    
          
       acc=[select id,name from account where id=:accid];
        cons= [SELECT ID,Name,Mailingstreet,Mailingcity,Mailingcountry,Mailingstate,Mailingpostalcode FROM contact where accountid=:accid];
        
         
    }       
}


Visual page:

<apex:page controller="getaddress" renderAs="pdf" >

<apex:form>  
<apex:outputPanel layout="block" style="overflow:auto;height:190px;">



    
        <table width="100%" ><tr><apex:repeat value="{!cons}" var="u"><td width="100%" colspan="3" style="display:block;float:horizental">
                     
                      <apex:outputfield value="{!u.Mailingstreet}"></apex:outputfield><br/>

                     <apex:outputfield value="{!u.Mailingcity}"></apex:outputfield><br/>
                      <apex:outputfield value="{!u.Mailingstate}"></apex:outputfield><br/>
                      <apex:outputfield value="{!u.Mailingcountry}"></apex:outputfield>
                      <apex:outputfield value="{!u.Mailingpostalcode }"></apex:outputfield>
</td><br/></apex:repeat></tr></table>
</apex:outputPanel>

            
</apex:form>    
</apex:page>
Here my code is
public class getaddress

    public String obj;
    public account acc{get;set;}
    public List<contact> cons{get;set;}
    public id accid=apexpages.currentpage().getparameters().get('id'); 
     
    
    public getaddress() 
    {    
          
       acc=[select id,name from account where id=:accid];
        cons= [SELECT ID,Name,Mailingstreet,Mailingcity,Mailingcountry,Mailingstate,Mailingpostalcode FROM contact where accountid=:accid];
        
         
    }       
}



Visual page:

<apex:page controller="getaddress" renderAs="pdf" >

<apex:form>  
<apex:outputPanel layout="block" style="overflow:auto;height:190px;">



    
        <table width="100%" ><tr><apex:repeat value="{!cons}" var="u"><td width="100%" colspan="3" style="display:block;float:horizental">
                     
                      <apex:outputfield value="{!u.Mailingstreet}"></apex:outputfield><br/>

                     <apex:outputfield value="{!u.Mailingcity}"></apex:outputfield><br/>
                      <apex:outputfield value="{!u.Mailingstate}"></apex:outputfield><br/>
                      <apex:outputfield value="{!u.Mailingcountry}"></apex:outputfield>
                      <apex:outputfield value="{!u.Mailingpostalcode }"></apex:outputfield>
</td><br/></apex:repeat></tr></table>
</apex:outputPanel>

            
</apex:form>    
</apex:page>
User-added image
Hi
When i click on Get Contacts button i need address information of multiple contacts under account list..for example if i had 6 contacts under same account i need 6 contacts address information like below page.it supposed to be appear in 3 columns.Help me the button code?User-added imageUser-added image
Hi can u help me the test coverage for below code?
Public class NewPayment{

    public Payment__c pm{get;set;}
    //public id oppid=apexpages.currentpage().getparameters().get('oppid');
    //public id woid=apexpages.currentpage().getparameters().get('id');
    public Work_Order__c wo{get;set;}
    public Opportunity opp{get;set;}
    public Opportunity oppp{get;set;}
    public string oppid{get;set;}
    public string woid{get;set;}
    public NewPayment(ApexPages.StandardController controller)
    {
        pm= new Payment__c();
        wo=new Work_Order__c();
        opp=new opportunity();
        oppid=apexpages.currentpage().getparameters().get('CF00Nq000000162bj_lkid');
        woid=apexpages.currentpage().getparameters().get('CF00Nq000000162bt_lkid');
        
       
        
        if(oppid!=null)
        {
            oppp=[select id,name,amount,Amount_Paid__c,Balance_Due__c from opportunity where id=:oppid];
            pm.Payment_Date__c=system.today();
            pm.Price__c=oppp.Balance_Due__c;
        }
        
        else if(woid!=null)
        {
            wo=[select id,name,Grand_Total__c,Amount_Paid__c,Balance_Due__c from work_order__c where id=:woid];
            pm.Payment_Date__c=system.today();
            pm.Price__c=wo.Balance_Due__c;
        }
    }
    
    public pagereference save()
    {
        if(pm.Payment_Mode__c!=null)
        {
            if(oppid!=null)
            {
                opp=[select id,name,Primary_Client_Project_Manager_Email__c,Amount_Paid__c,amount from opportunity where id=:oppid];
                pm.Opportunity__c=oppid;
                pm.email__c=opp.Primary_Client_Project_Manager_Email__c;
                if(opp.Amount_Paid__c!=null)
                    opp.Amount_Paid__c= opp.Amount_Paid__c+pm.Price__c;
                else
                    opp.Amount_Paid__c= pm.Price__c;
                for(Work_Order__c  wo:[select id,name,Amount_Paid__c from Work_Order__c  where Opportunity__c=:oppid limit 1])    
                {
                    pm.Work_Order__c=wo.id;
                    wo.Amount_Paid__c=opp.Amount_Paid__c;
                    
                    update wo;
                }
                update opp;
                //opp.Balance_Due__c=opp.amount-pm.Price__c;
               /*  if([select count() from Work_Order__c where Opportunity__c=:oppid]>0)
                {
                      wo=[select id,name,Grand_Total__c,Balance_Due__c,Amount_Paid__c from work_order__c where id=:woid];
                      
                      wo.Amount_Paid__c=pm.Price__c;
                      wo.Balance_Due__c=wo.Grand_Total__c-pm.Price__c;
                      
                      
                }*/
                
               
                
            }
            else if(woid!=null)
            {
                wo=[select id,name,Opportunity__c,Amount_Paid__c,Opportunity__r.Primary_Client_Project_Manager_Email__c   from Work_Order__c  where id=:woid];
                pm.Work_Order__c=woid;
                pm.Opportunity__c=wo.Opportunity__c ;
                pm.email__c=wo.Opportunity__r.Primary_Client_Project_Manager_Email__c;
                if(wo.Amount_Paid__c!=null)
                    wo.Amount_Paid__c=wo.Amount_Paid__c+pm.Price__c;
                else
                    wo.Amount_Paid__c=pm.Price__c;
                //wo.Balance_Due__c=wo.Grand_Total__c-pm.Price__c;
                 opp=[select id,name,Primary_Client_Project_Manager_Email__c,Amount_Paid__c,amount from opportunity where id=:wo.Opportunity__c];
                 opp.Amount_Paid__c=opp.Amount_Paid__c+pm.Price__c;
                 update wo;
                 update opp;
            }
            
             insert pm;
           
              if(oppid!=null)
               {
                    
                   
                    pagereference pr1 =new pagereference('/'+oppid);
                    pr1.setredirect(true);
                    return pr1;
               }
               
               else if(woid!=null)
               {
                    
                    pagereference pr1 =new pagereference('/'+woid);
                    pr1.setredirect(true);
                    return pr1;
                }
        }
       return null;
    }
    public pagereference cancel()
    {
        if(oppid!=null)
       {
            pagereference pr1 =new pagereference('/'+oppid);
            pr1.setredirect(true);
            return pr1;
       }
       
       else if(woid!=null)
       {
            pagereference pr1 =new pagereference('/'+woid);
            pr1.setredirect(true);
            return pr1;
        }
        return null;
    }
}
Here my code is,

public class UplaodLead
{
    public blob leadcsvfile{get;set;}
    public UplaodLead()
    {
        
    }
    public void save()
    {
        if(leadcsvfile!=null)
        {
            try
            {    
                list<lead> leadlist=new list<lead>();
                string Csvfilestring=leadcsvfile.tostring();
                boolean header=false;
                for(string Columns:Csvfilestring.split('\n'))
                {
                    if(header==false)
                    {
                        header=true;
                        continue;
                    }
                    integer i=0;
                     lead lr=new lead();
                    for(string Fields:Columns.split(','))
                    {
                       
                        if(i==0)
                            lr.firstname=Fields;
                        else if(i==3)
                        {
                           lr.lastname=Fields;
                         }
                          else if(i==5)
                         {
                           lr.Email=Fields;
                         }
                          else if(i==6)
                         {
                           lr.Company=Fields;
                         }
                          else if(i==7)
                         {
                           lr.Department__c=Fields;
                         }
                          else if(i==8)
                         {
                           lr.Job_Title__c=Fields;
                         }
                          else if(i==9)
                         {
                           lr.street=Fields;
                         }
                         else if(i==10)
                         {
                           lr.Business_Street_2__c=Fields;
                         }
                          else if(i==12)
                         {
                           lr.City=Fields;
                         }
                          else if(i==13)
                         {
                           lr.State=Fields;
                         }
                         else if(i==14)
                         {
                           lr.PostalCode=Fields;
                         }
                          else if(i==15)
                         {
                           lr.Country=Fields;
                         }
                          else if(i==16)
                         {
                           lr.Home_Street1__c=Fields;
                         }
                          else if(i==19)
                         {
                           lr.Home_City__c=Fields;
                         }
                          else if(i==20)
                         {
                           lr.Home_State__c=Fields;
                         }
                          else if(i==21)
                         {
                           lr.Home_Postal_Code__c=Fields;
                         }
                          else if(i==22)
                         {
                           lr.Home_Country_Region__c=Fields;
                         }
                          else if(i==23)
                         {
                           lr.Fax=Fields;
                         }
                          else if(i==24)
                         {
                           lr.Phone=Fields;
                         }
                          else if(i==25)
                         {
                           lr.Car_Phone__c=Fields;
                         }
                          else if(i==26)
                         {
                           lr.HomePhone__c=Fields;
                         }
                          else if(i==27)
                         {
                           lr.MobilePhone=Fields;
                         }
                          else if(i==28)
                         {
                           lr.Categories__c=Fields;
                         }
                          else if(i==29)
                         {
                           lr.E_mail_Type__c=Fields;
                         }
                          else if(i==30)
                         {
                           lr.E_mail_Display_Name__c=Fields;
                         }
                          else if(i==31)
                          {
                          lr.Description=Fields;
                           leadlist.add(lr);
                        }
                        
                        i++;
                    }
                }
                if(leadlist.size()>0)
                    insert leadlist;
            }
            catch(Exception e)
        {
             ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.ERROR,''+e.getmessage());//Same old drama 
             ApexPages.addMessage(myMsg);
        }
        }
        
    }
}
Here my code is

public class FileUploader 
{
    public string nameFile{get;set;}
    public Blob contentFile{get;set;}
    String[] filelines = new String[]{};
    List<Account> accstoupload;
    
    public Pagereference ReadFile()
    {
        try{
                nameFile =blobToString( contentFile,'ISO-8859-1');
                
                filelines = nameFile.split('\n');
                
                accstoupload = new List<Account>();
                for (Integer i=1;i<filelines.size();i++)
                {
                    String[] inputvalues = new String[]{};
                    inputvalues = filelines[i].split(',');
                    
                    Account a = new Account();
                    a.Name = inputvalues[0];
                    a.ShippingStreet = inputvalues[1];       
                    a.ShippingCity = inputvalues[2];
                    a.ShippingState = inputvalues[3];
                    a.ShippingPostalCode = inputvalues[4];
                    a.ShippingCountry = inputvalues[5];
        
                    accstoupload.add(a);
                }
         }
         catch(Exception e){
                 ApexPages.Message errormsg = new ApexPages.Message(ApexPages.severity.ERROR,'An error has occured reading the CSV file'+e.getMessage());
                ApexPages.addMessage(errormsg);
         }       
        try{
            insert accstoupload;
        }
        catch (Exception e)
        {
            ApexPages.Message errormsg = new ApexPages.Message(ApexPages.severity.ERROR,'An error has occured inserting the records'+e.getMessage());
            ApexPages.addMessage(errormsg);
        }    
        return null;
    }
   
    public List<Account> getuploadedAccounts()
    {
        if (accstoupload!= NULL)
            if (accstoupload.size() > 0)
                return accstoupload;
            else
                return null;                    
        else
            return null;
    }  
        
    public static String blobToString(Blob input, String inCharset){
        String hex = EncodingUtil.convertToHex(input);
        System.assertEquals(0, hex.length() & 1);
        final Integer bytesCount = hex.length() >> 1;
        String[] bytes = new String[bytesCount];
        for(Integer i = 0; i < bytesCount; ++i)
            bytes[i] =  hex.mid(i << 1, 2);
        return EncodingUtil.urlDecode('%' + String.join(bytes, '%'), inCharset);
    }         
}
Hi

how to integrate dot net with salesforce and brief information about dot net installation ? 
How to install dot net and instructions after installation?

Thanks
Hi
How to create visual force email template for below html template?


Dear {!Lead.FirstName}:
 
It was a pleasure spending time with you yesterday and today.
 
At one, we enjoy contributing to the continued success of progressive companies like {!Account.Name}. I look forward to continuing our dialogues and will be in touch regarding our discussion. In the mean time, if you have any additional questions, please do not hesitate to contact me directly.
 
Sincerely,
{!User.Name}
{!User.Phone}
{!User.Email}

 
Hi

if i enter a text in text box i need that text into a signature style box with different font styles how to design a visual page for that?




here my code is




<apex:page controller="generate" pageStyle="vertic" renderAs="pdf" >

<APEX:FOrm >
 


 Opportunity Name:{!opp.name} <br/>
<apex:pageblock >
        
            <table width="100%" border="0" >
                <tr>
                    
                    <td width="28%"><apex:image url="{!$Resource.google}"/></td>
                   
                     
                    <td width="5%"> </td>
                    <td width="8%"> </td>
                    <td width="8%"> </td>
                     <td width="59%">
                        <table width="65%" align="right">
                            <tr>
                                <td width="100%" align="right" style="font-size:12pt">Estimate</td>
                            </tr>
                            <tr>
                                <td width="100%" align="center" >
                                     <table width="100%" border="1" align="right">
                                         <tr>
                                            <td width="40%" bgcolor="#127826"><center>DATE</center></td>                              
                                         </tr>
                                         <tr>
                                            <!--<td width="40%" style="text-align:center"><apex:outputField value="{!opp.Invoice_No__c}"> </apex:outputField></td>-->
                                             <td width="40%" style="text-align:center"><apex:outputtext value="{!myDate}"/></td>
                                           
                                         </tr>
                                     </table>    
                                  </td>
                              </tr>
                         </table>
                     </td>
                  </tr>
                  
                  
                 
             </table>       
          </apex:pageblock>
          
                    


    <apex:pageBlock >
        <apex:pageBlockTable value="{!fsrd}" var="fr" columnsWidth="40%,30%,30%" border="1">
            <apex:column value="{!fr.name}"/>
            <apex:column value="{!fr.Comments__c}"/>
            <apex:column value="{!fr.Opportunity__c}"/>
           
        </apex:pageBlockTable>
    </apex:pageBlock>
    
    <br>  </br>
    
   
    
    
</APEX:FOrm>
 
</apex:page>
Here my code is
public class getaddress

    public String obj;
    public account acc{get;set;}
    public List<contact> cons{get;set;}
    public id accid=apexpages.currentpage().getparameters().get('id'); 
     
    
    public getaddress() 
    {    
          
       acc=[select id,name from account where id=:accid];
        cons= [SELECT ID,Name,Mailingstreet,Mailingcity,Mailingcountry,Mailingstate,Mailingpostalcode FROM contact where accountid=:accid];
        
         
    }       
}



Visual page:

<apex:page controller="getaddress" renderAs="pdf" >

<apex:form>  
<apex:outputPanel layout="block" style="overflow:auto;height:190px;">



    
        <table width="100%" ><tr><apex:repeat value="{!cons}" var="u"><td width="100%" colspan="3" style="display:block;float:horizental">
                     
                      <apex:outputfield value="{!u.Mailingstreet}"></apex:outputfield><br/>

                     <apex:outputfield value="{!u.Mailingcity}"></apex:outputfield><br/>
                      <apex:outputfield value="{!u.Mailingstate}"></apex:outputfield><br/>
                      <apex:outputfield value="{!u.Mailingcountry}"></apex:outputfield>
                      <apex:outputfield value="{!u.Mailingpostalcode }"></apex:outputfield>
</td><br/></apex:repeat></tr></table>
</apex:outputPanel>

            
</apex:form>    
</apex:page>
User-added image
Hi can u help me the test coverage for below code?
Public class NewPayment{

    public Payment__c pm{get;set;}
    //public id oppid=apexpages.currentpage().getparameters().get('oppid');
    //public id woid=apexpages.currentpage().getparameters().get('id');
    public Work_Order__c wo{get;set;}
    public Opportunity opp{get;set;}
    public Opportunity oppp{get;set;}
    public string oppid{get;set;}
    public string woid{get;set;}
    public NewPayment(ApexPages.StandardController controller)
    {
        pm= new Payment__c();
        wo=new Work_Order__c();
        opp=new opportunity();
        oppid=apexpages.currentpage().getparameters().get('CF00Nq000000162bj_lkid');
        woid=apexpages.currentpage().getparameters().get('CF00Nq000000162bt_lkid');
        
       
        
        if(oppid!=null)
        {
            oppp=[select id,name,amount,Amount_Paid__c,Balance_Due__c from opportunity where id=:oppid];
            pm.Payment_Date__c=system.today();
            pm.Price__c=oppp.Balance_Due__c;
        }
        
        else if(woid!=null)
        {
            wo=[select id,name,Grand_Total__c,Amount_Paid__c,Balance_Due__c from work_order__c where id=:woid];
            pm.Payment_Date__c=system.today();
            pm.Price__c=wo.Balance_Due__c;
        }
    }
    
    public pagereference save()
    {
        if(pm.Payment_Mode__c!=null)
        {
            if(oppid!=null)
            {
                opp=[select id,name,Primary_Client_Project_Manager_Email__c,Amount_Paid__c,amount from opportunity where id=:oppid];
                pm.Opportunity__c=oppid;
                pm.email__c=opp.Primary_Client_Project_Manager_Email__c;
                if(opp.Amount_Paid__c!=null)
                    opp.Amount_Paid__c= opp.Amount_Paid__c+pm.Price__c;
                else
                    opp.Amount_Paid__c= pm.Price__c;
                for(Work_Order__c  wo:[select id,name,Amount_Paid__c from Work_Order__c  where Opportunity__c=:oppid limit 1])    
                {
                    pm.Work_Order__c=wo.id;
                    wo.Amount_Paid__c=opp.Amount_Paid__c;
                    
                    update wo;
                }
                update opp;
                //opp.Balance_Due__c=opp.amount-pm.Price__c;
               /*  if([select count() from Work_Order__c where Opportunity__c=:oppid]>0)
                {
                      wo=[select id,name,Grand_Total__c,Balance_Due__c,Amount_Paid__c from work_order__c where id=:woid];
                      
                      wo.Amount_Paid__c=pm.Price__c;
                      wo.Balance_Due__c=wo.Grand_Total__c-pm.Price__c;
                      
                      
                }*/
                
               
                
            }
            else if(woid!=null)
            {
                wo=[select id,name,Opportunity__c,Amount_Paid__c,Opportunity__r.Primary_Client_Project_Manager_Email__c   from Work_Order__c  where id=:woid];
                pm.Work_Order__c=woid;
                pm.Opportunity__c=wo.Opportunity__c ;
                pm.email__c=wo.Opportunity__r.Primary_Client_Project_Manager_Email__c;
                if(wo.Amount_Paid__c!=null)
                    wo.Amount_Paid__c=wo.Amount_Paid__c+pm.Price__c;
                else
                    wo.Amount_Paid__c=pm.Price__c;
                //wo.Balance_Due__c=wo.Grand_Total__c-pm.Price__c;
                 opp=[select id,name,Primary_Client_Project_Manager_Email__c,Amount_Paid__c,amount from opportunity where id=:wo.Opportunity__c];
                 opp.Amount_Paid__c=opp.Amount_Paid__c+pm.Price__c;
                 update wo;
                 update opp;
            }
            
             insert pm;
           
              if(oppid!=null)
               {
                    
                   
                    pagereference pr1 =new pagereference('/'+oppid);
                    pr1.setredirect(true);
                    return pr1;
               }
               
               else if(woid!=null)
               {
                    
                    pagereference pr1 =new pagereference('/'+woid);
                    pr1.setredirect(true);
                    return pr1;
                }
        }
       return null;
    }
    public pagereference cancel()
    {
        if(oppid!=null)
       {
            pagereference pr1 =new pagereference('/'+oppid);
            pr1.setredirect(true);
            return pr1;
       }
       
       else if(woid!=null)
       {
            pagereference pr1 =new pagereference('/'+woid);
            pr1.setredirect(true);
            return pr1;
        }
        return null;
    }
}
Here my code is,

public class UplaodLead
{
    public blob leadcsvfile{get;set;}
    public UplaodLead()
    {
        
    }
    public void save()
    {
        if(leadcsvfile!=null)
        {
            try
            {    
                list<lead> leadlist=new list<lead>();
                string Csvfilestring=leadcsvfile.tostring();
                boolean header=false;
                for(string Columns:Csvfilestring.split('\n'))
                {
                    if(header==false)
                    {
                        header=true;
                        continue;
                    }
                    integer i=0;
                     lead lr=new lead();
                    for(string Fields:Columns.split(','))
                    {
                       
                        if(i==0)
                            lr.firstname=Fields;
                        else if(i==3)
                        {
                           lr.lastname=Fields;
                         }
                          else if(i==5)
                         {
                           lr.Email=Fields;
                         }
                          else if(i==6)
                         {
                           lr.Company=Fields;
                         }
                          else if(i==7)
                         {
                           lr.Department__c=Fields;
                         }
                          else if(i==8)
                         {
                           lr.Job_Title__c=Fields;
                         }
                          else if(i==9)
                         {
                           lr.street=Fields;
                         }
                         else if(i==10)
                         {
                           lr.Business_Street_2__c=Fields;
                         }
                          else if(i==12)
                         {
                           lr.City=Fields;
                         }
                          else if(i==13)
                         {
                           lr.State=Fields;
                         }
                         else if(i==14)
                         {
                           lr.PostalCode=Fields;
                         }
                          else if(i==15)
                         {
                           lr.Country=Fields;
                         }
                          else if(i==16)
                         {
                           lr.Home_Street1__c=Fields;
                         }
                          else if(i==19)
                         {
                           lr.Home_City__c=Fields;
                         }
                          else if(i==20)
                         {
                           lr.Home_State__c=Fields;
                         }
                          else if(i==21)
                         {
                           lr.Home_Postal_Code__c=Fields;
                         }
                          else if(i==22)
                         {
                           lr.Home_Country_Region__c=Fields;
                         }
                          else if(i==23)
                         {
                           lr.Fax=Fields;
                         }
                          else if(i==24)
                         {
                           lr.Phone=Fields;
                         }
                          else if(i==25)
                         {
                           lr.Car_Phone__c=Fields;
                         }
                          else if(i==26)
                         {
                           lr.HomePhone__c=Fields;
                         }
                          else if(i==27)
                         {
                           lr.MobilePhone=Fields;
                         }
                          else if(i==28)
                         {
                           lr.Categories__c=Fields;
                         }
                          else if(i==29)
                         {
                           lr.E_mail_Type__c=Fields;
                         }
                          else if(i==30)
                         {
                           lr.E_mail_Display_Name__c=Fields;
                         }
                          else if(i==31)
                          {
                          lr.Description=Fields;
                           leadlist.add(lr);
                        }
                        
                        i++;
                    }
                }
                if(leadlist.size()>0)
                    insert leadlist;
            }
            catch(Exception e)
        {
             ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.ERROR,''+e.getmessage());//Same old drama 
             ApexPages.addMessage(myMsg);
        }
        }
        
    }
}
Hi
How to integrate facebook with salesforce.please provide installation links for install facebook.
Thanks
hi ,

how to write Condition when stage value is pending and then the records has to be updated