• ForceLover
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 52
    Questions
  • 77
    Replies
Hi Everyone,

I want to share my user accounts,opportunities and lead records when he is out of office with a deligated user .And when he returns back the sharing as to stop.

Please share your views on this and tell me the way how can I achieve this.
Hi Everyone,

I want to share my user accounts,opportunities and lead records when he is out of office with a deligated user .And when he returns back the sharing as to stop.

Please share your views on this and tell me the way how can I achieve this.
Hi Everyone,

I want to share my user accounts,opportunities and lead records when he is out of office with a deligated user .And when he returns back the sharing as to stop.

Please share your views regarding this.

Hi,

 

Need a confirmation, my org don't have any portal user licenses.But i created a method in a test class which will create a portal user.It is saved successfully without any error.But i used this method in some other test class while i'm running second test class it is failing with the following error message

 

System.DmlException: Insert failed. First exception on row 0; first error: FIELD_INTEGRITY_EXCEPTION, only portal users can be associated to a contact: []

 

why i'm getting this error because of not having licenses or some other please confirm me.

Hi Everyone,

 

I want to pass my attachment body which i'm querying in the script to the javascript function

base64_decode (some base64variable).

Actually attachement body is of type Base64.

 

<script>
  var existingSel = document.getElementById('select_0');
  sforce.connection.sessionId = '{!$Api.Session_ID}';
 
  var qr = sforce.connection.query("Select Id,ParentId, Name,body,ContentType From Attachment where ParentId=:'0039000000InSjOAAV'") ;
  var records = qr.getArray(“records”)
 
  for (var i=0;i<qr.records.length;i++)
  {
   alert(qr.records[i].Body);
  }

  function base64_decode (some variable) {
 
 ////////////////// Some Logic Here==========================
}
</script>

Hi,

 

is there anybody using this application,i need some clarifications regarding Leads-companies object.

 

 

HI

 

I want when an user enters an img URL into salesforce and clicks a button, that code would go out to the image online, downloads it and inserts it into Salesforce on the record as an attachment.can someone suggest me How to proceed with this.

 

Thanks in Advance

Hi,

 

I have a situation to update the probability field with some other fields in opportunity object based on stage changes.

Like i have stage picklist values as A,B,C,D,E.

So when when mt stage is A i want to update probability with a Customfield1__c same for all stages.

Here i need to create different WFRs,is there any way to update probability for different stages in a single WFR.

 

 

HI,

 

My VF page is not refreshing the pageblocktable while clicking the save button,i used rerender of pageblock on the button but still it's not refreshing.

 

Here is my VF code

<apex:page standardController="LeadBackup__c" sidebar="false" extensions="SiteLead" tabStyle="Lead">
 <head>
    <style>
        .startStyle{
            font-size:12px;
            font-weight:bold;
            color:red;
        }     
    </style>
 </head>
        
  <apex:sectionHeader title="Lead Form" subtitle="New Lead" />
    <apex:outputPanel id="hiddenblock">
    <apex:pagemessages />
    </apex:outputPanel>
     <apex:form id="frm">
    <div style="width:1400px; padding-left:5%; ">
     <apex:pageBlock id="Block" mode="edit">
     <apex:pageBlockButtons location="both">
        <apex:commandButton action="{!save}" value="Save Records" rerender="hiddenblock, Block" />
        <apex:commandButton action="{!cancel}" value="Cancel"/>
      </apex:pageBlockButtons>
        <apex:pageBlockSection >
         <apex:pageblockSectionItem >
      
          <apex:outputLabel for="searchText" style="font-size:14px">RefID/FileNumber</apex:outputLabel>
          <apex:panelGroup >
          <apex:inputText id="searchText" value="{!searchText}"/>
          <apex:commandButton value="Search" action="{!search}" rerender="hiddenblock, Block" status="status"/>         
          </apex:panelGroup>
         </apex:pageblockSectionItem>
         
        </apex:pageBlockSection>
        
        <apex:actionStatus id="status" startText="Searching... please wait..."/>
      <apex:pageBlockSection title="Lead Results" id="resultsBlock" columns="1">
        <apex:pageBlockTable value="{!searchResults}" var="LeadBackup__c" rendered="{!NOT(ISNULL(searchResults))}">
          <apex:column value="{!LeadBackup__c.Name}" headerValue="LeadName" width="100">
          </apex:column>
          <apex:column value="{!LeadBackup__c.Street__c}" headerValue="Street" width="100"/>
          <apex:column value="{!LeadBackup__c.City__c}" headerValue="City" width="100"/>
          <apex:column value="{!LeadBackup__c.State__c}" headerValue="State" width="100"/>
        
        <!--  <apex:column headerValue="First Name" width="100">
            <apex:inputField value="{!Lead.FirstName}"/>
          </apex:column>
          <apex:column headerValue="Last Name" width="100">
            <apex:inputField value="{!Lead.LastName}"/>
          </apex:column> -->
          
          <apex:column headerValue="Email" width="100" style="font-size:12px">
            <apex:inputField value="{!LeadBackup__c.Email__c}"/>
          </apex:column>
          <apex:column headerValue="Phone" width="100">
            <apex:inputField value="{!LeadBackup__c.Phone__c}"/>
          </apex:column>
          <apex:column headerValue="Evening Phone" width="100">
            <apex:inputField value="{!LeadBackup__c.Evening_Phone__c}"/>
          </apex:column>
          <apex:column headerValue="Preferred Call Time" width="100">
            <apex:inputField value="{!LeadBackup__c.Preferred_Call_Time__c}"/>
          </apex:column>
          <apex:column headerValue="Notes" width="100">
            <apex:inputField value="{!LeadBackup__c.Notes__c}"/>
          </apex:column>
          <apex:column headerValue="Do Not Call" width="100">
            <apex:inputField value="{!LeadBackup__c.Do_Not_Call__c}"/>
          </apex:column>
          
        </apex:pageBlockTable>
      </apex:pageBlockSection>
     </apex:pageBlock>
    </div> 
   </apex:form>
</apex:page>

 Thanks in advance.

Hi,

 

I created a flow which will updates a lead record based on a search field in lead,which is working good like,when i'm searching for lead it retrieves the record from lead and make some updates to that record too but i used this flow in a VF page and i used that VF page a site then i'm getting folloing error...

 

 I have this field notes__c on lead object but the error msg showing this    

 

Unhandled process fault from Gmail : Test_Flow_For_Lead_Update : interaction.dal.exception.DALExecutionFault: ; nested exception is: common.exception.ApiQueryException: SELECT Lead.Email, Lead.notes__c FROM Lead WHERE (Lead.Ref_ID_File_Number__c ^ ERROR at Row:1:Column:20 No such column 'notes__c' on entity 'Lead'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names. (There was a problem executing your command.) > RETRIEVE

 

 

Hi,

 

I need your suggestions on this issue

 

1) I have 10 leads on a lead queue for example numbered as 1,2,3,4,5,6,7,8,9,10.while follow up, the lead3 is not responded say went to voice mail, then the lead3 should come in an order in the queue like 4,5,6,7,8,9,10,3

 

How i can achieve this...

Hi Everyone,

 

I have two buttons checkformat,search.I want to disable my search button untill user check for his format with checkformat button.I'm using a javascript to check the format of my inputtext.

 

Here is my code,

 

<apex:panelGroup >
          <apex:inputText id="searchText" value="{!searchText}" onblur="checkingstring(this)"/>
          <button onclick="alert('Correct Format !');">CheckFormat</button>         
          <apex:commandButton value="Search" action="{!search}" rerender="resultsBlock" status="status" disabled="true"/></apex:panelGroup>

 

<script>
function checkingstring(searchText){
    var regexp = /^[A-Z]{2}\d{4}-\d{5}$/i; //AANNNN-NNNNN A = Capital N = Number
    if (!regexp.exec(searchText.value)) {
        alert("The syntax is always as follows: AANNNN-NNNNN (A= Alpha/Letter; N= Number) i.e.FL0301-12345</b>");  
    }
}
</script>

 

 

for my search button it will search for the text on the object if it is not on object it will create a record with the searchtext and it will display thwe record in edit mode to update some of the values..if the record exists it will simply displays the record..

 

public pagereference search(){

 

/// code goes here

 

}

 

Search should be enable only when the text is in correct format....

 

 

Hello Everyone,

 

I want to check whether my one of inputtext field in a desired format or not ,in this case i'm getting the mentioned exception

 

Visualforce Error....Exception: Matcher is not serializable. 

 

i want my inputtext should be as   AANNNN-NNNNN (A= Alpha/Letter; N= Number) for eg: "AS1234-56789"

 

My Vf page:

 

<apex:page>

--------

<apex:panelGroup >
<apex:inputText id="searchText" value="{!searchText}"/>
<apex:commandButton value="Search" action="{!search}" rerender="resultsBlock" status="status"/>
</apex:panelGroup>

------------------------

</apex:page>

 

My controller:

 

i'm searching using matcher like this in my controller

 

 

Public class sitelead{

 

public string searchText {get;set;}

 

String REFIDRegex = '([a-zA-Z](2)[0-9](4)-[0-9](5))';
Pattern MyPattern = Pattern.compile(REFIDRegex);
Matcher MyMatcher = MyPattern.matcher(searchText);

 

}

 I have a inputtext  in my VF page  as

 

        <apex:pageBlockSection >
         <apex:pageblockSectionItem >
          <apex:outputLabel for="searchText" style="font-size:14px">RefID/FileNumber</apex:outputLabel>
          <apex:panelGroup >
          <apex:inputText id="searchText" value="{!searchText}"/>
          <apex:commandButton value="Search" action="{!search}" rerender="resultsBlock" status="status"/>
          </apex:panelGroup>
         </apex:pageblockSectionItem>
        </apex:pageBlockSection>

 

I'm using that text field in my controller to compare one of my text field in the LeadBackup__c object as

 

public PageReference search() {
   // String qry = 'select id,Ref_ID_File_Number__c, Email__c, Phone__c, Street__c, City__c, State__c, TAB_Message__c, Evening_Phone__c, Preferred_Call_Time__c, Notes__c,DoNotCall__c from LeadBackup__c' + where Ref_ID_File_Number__c = searchText  order by name';
    searchResults1 = [select id,RefID_FileNumber__c,Name, Email__c, Phone__c, Street__c, City__c, State__c, TAB_Message__c, TAB_Time_stamp__c, Evening_Phone__c, Preferred_Call_Time__c, Notes__c,Do_Not_Call__c from LeadBackup__c where RefID_FileNumber__c =:searchText  order by name];
    //searchResults = Database.query(qry);
   
     
     //searchResults = [select id, name, FirstName, LastName, Status, Ref_ID_File_Number__c, Email, Phone, Street, City, State, Country, PostalCode, TAB_Message__c, Evening_Phone__c, Preferred_Call_Time__c, Notes__c,DoNotCall from Lead where Ref_ID_File_Number__c =:searchText  order by name];

   
    if(searchResults1.size()==0){

          LeadBackup__c lb = new  LeadBackup__c(RefID_FileNumber__c = searchText,
                                                Name=[select name,id from lead where Ref_ID_File_Number__c=:searchtext ].Name,
                                                City__c=[select name,id,city from lead where Ref_ID_File_Number__c=:searchtext ].City,
                                                Street__c=[select name,id,street from lead where Ref_ID_File_Number__c=:searchtext ].street,
                                                State__c=[select name,id,state from lead where Ref_ID_File_Number__c=:searchtext ].state,
                                                Lead__c = [select name,id from lead where Ref_ID_File_Number__c=:searchtext ].id,
                                                Email__c = [select name,id,Email from lead where Ref_ID_File_Number__c=:searchtext ].Email,
                                                Phone__c = [select name,id,Email,Phone from lead where Ref_ID_File_Number__c=:searchtext].Phone,
                                                Evening_Phone__c = [select name,id,Evening_Phone__c  from lead where                 Ref_ID_File_Number__c=:searchtext ].Evening_Phone__c,
                                                Preferred_Call_Time__c = [select name,id,Evening_Phone__c,Preferred_Call_Time__c   from lead where Ref_ID_File_Number__c=:searchtext ].Preferred_Call_Time__c,
                                                Notes__c = [select name,id,Evening_Phone__c,Notes__c   from lead where Ref_ID_File_Number__c=:searchtext ].Notes__c,
                                                Do_Not_Call__c = [select name,id,Evening_Phone__c,DoNotCall   from lead where Ref_ID_File_Number__c=:searchtext ].DoNotCall);
          //searchResults.add(lb);
          system.debug('lb'+lb);
          insert lb ;
          
          searchResults = [select id,RefID_FileNumber__c,Name, Email__c, Phone__c, Street__c, City__c, State__c, TAB_Message__c, TAB_Time_stamp__c, Evening_Phone__c, Preferred_Call_Time__c, Notes__c,Do_Not_Call__c from LeadBackup__c where RefID_FileNumber__c =:searchText  order by name];

          
    }else{
    
       ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Info,'<b>Please confirm name and address below. Address will be where the letter was received/addressed. If these do not match, you will need to re-verify Ref ID, as it may have been entered incorrectly</b>'));
       
       searchResults = [select id,RefID_FileNumber__c,Name, Email__c, Phone__c, Street__c, City__c, State__c, TAB_Message__c, TAB_Time_stamp__c, Evening_Phone__c, Preferred_Call_Time__c, Notes__c,Do_Not_Call__c from LeadBackup__c where RefID_FileNumber__c =:searchText  order by name];

       return null;
    }
    return null;
  }
 
 
  public PageReference save() {
   
   if(!(String.isEmpty(searchText))){  -----------------From Here my code is not covering how to pass this search text in test class
          
       try {
            
            list<LeadBackup__c> lstupdate = new list<LeadBackup__c>();
            
                 
             For(LeadBackup__c le:searchResults){
             
             //le.Id = lead.Id;
             le.RefID_FileNumber__c = searchResults[0].RefID_FileNumber__c ;
             le.Lead__c = [select name,id from lead where Ref_ID_File_Number__c=:searchtext ].id;
             le.Name = searchResults[0].Name;
             le.Email__c = searchResults[0].Email__c;
             le.Phone__c = searchResults[0].Phone__c;
             le.Evening_Phone__c = searchResults[0].Evening_Phone__c ;
             le.Preferred_Call_Time__c = searchResults[0].Preferred_Call_Time__c;
             le.Notes__c = searchResults[0].Notes__c;
             le.Do_Not_Call__c = searchResults[0].Do_Not_Call__c;
             le.TAB_Message__c = True;
             le.TAB_Time_stamp__c = System.now();
             lstupdate.add(le);
             }
             
             update lstupdate;
      
      ApexPages.addmessage(new ApexPages.message(ApexPages.severity.info,'Record <b>'+searchResults[0].Name+'</b> has been Updated'));
            
    } Catch (DMLException e) {
      ApexPages.addMessages(e);
      return null;
    }
   
    searchText='';
    searchResults.clear();
    return null;
       
  }
  else
  {
       ApexPages.addmessage(new ApexPages.message(ApexPages.severity.info,'Please enter REFID/FileNumber'));
  }
 
  return null;
 
}

 

How to pass this search text to the test class ......

Any help would appreciated greatly...

 

 

I have a VF page which will search for records based on a string value REFID here is my controller please help me in this regard

 

public  class SiteLead {
    
    private ApexPages.StandardController controller {get; set;}
    public List<LeadBackup__c> searchResults {get;set;}
     public List<LeadBackup__c> searchResults1 {get;set;}
    public string searchText {get;set;}
    //public Lead Leads;
   
    
    public SiteLead(ApexPages.StandardController controller) {
    


    }
    
    List<Lead> Leads=[select id, name, FirstName, LastName, Status, Ref_ID_File_Number__c, Email, Phone, Street, City, State, Country, PostalCode, TAB_Message__c, Evening_Phone__c, Preferred_Call_Time__c, Notes__c,DoNotCall from Lead where Ref_ID_File_Number__c =:searchText AND IsConverted=false ];
    
    public PageReference search() {
   // String qry = 'select id,Ref_ID_File_Number__c, Email__c, Phone__c, Street__c, City__c, State__c, TAB_Message__c, Evening_Phone__c, Preferred_Call_Time__c, Notes__c,DoNotCall__c from LeadBackup__c' + where Ref_ID_File_Number__c = searchText  order by name';
    searchResults1 = [select id,RefID_FileNumber__c,Name, Email__c, Phone__c, Street__c, City__c, State__c, TAB_Message__c, TAB_Time_stamp__c, Evening_Phone__c, Preferred_Call_Time__c, Notes__c,Do_Not_Call__c from LeadBackup__c where RefID_FileNumber__c =:searchText  order by name];
    //searchResults = Database.query(qry);
   
     
     //searchResults = [select id, name, FirstName, LastName, Status, Ref_ID_File_Number__c, Email, Phone, Street, City, State, Country, PostalCode, TAB_Message__c, Evening_Phone__c, Preferred_Call_Time__c, Notes__c,DoNotCall from Lead where Ref_ID_File_Number__c =:searchText  order by name];

   
    if(searchResults1.size()==0){

          LeadBackup__c lb = new  LeadBackup__c(RefID_FileNumber__c = searchText, 
                                                Name=[select name,id from lead where Ref_ID_File_Number__c=:searchtext ].Name,
                                                City__c=[select name,id,city from lead where Ref_ID_File_Number__c=:searchtext ].City,
                                                Street__c=[select name,id,street from lead where Ref_ID_File_Number__c=:searchtext ].street,
                                                State__c=[select name,id,state from lead where Ref_ID_File_Number__c=:searchtext ].state,
                                                Lead__c = [select name,id from lead where Ref_ID_File_Number__c=:searchtext ].id, 
                                                Email__c = [select name,id,Email from lead where Ref_ID_File_Number__c=:searchtext ].Email, 
                                                Phone__c = [select name,id,Email,Phone from lead where Ref_ID_File_Number__c=:searchtext ].Phone,
                                                Evening_Phone__c = [select name,id,Evening_Phone__c  from lead where Ref_ID_File_Number__c=:searchtext ].Evening_Phone__c, 
                                                Preferred_Call_Time__c = [select name,id,Evening_Phone__c,Preferred_Call_Time__c   from lead where Ref_ID_File_Number__c=:searchtext ].Preferred_Call_Time__c, 
                                                Notes__c = [select name,id,Evening_Phone__c,Notes__c   from lead where Ref_ID_File_Number__c=:searchtext ].Notes__c,
                                                Do_Not_Call__c = [select name,id,Evening_Phone__c,DoNotCall   from lead where Ref_ID_File_Number__c=:searchtext ].DoNotCall);
          //searchResults.add(lb);
          system.debug('lb'+lb);
          insert lb ;
          
          searchResults = [select id,RefID_FileNumber__c,Name, Email__c, Phone__c, Street__c, City__c, State__c, TAB_Message__c, TAB_Time_stamp__c, Evening_Phone__c, Preferred_Call_Time__c, Notes__c,Do_Not_Call__c from LeadBackup__c where RefID_FileNumber__c =:searchText  order by name];

          
    }else{
    
       ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Info,'<b>Please confirm name and address below. Address will be where the letter was received/addressed. If these do not match, you will need to re-verify Ref ID, as it may have been entered incorrectly</b>'));
       
       searchResults = [select id,RefID_FileNumber__c,Name, Email__c, Phone__c, Street__c, City__c, State__c, TAB_Message__c, TAB_Time_stamp__c, Evening_Phone__c, Preferred_Call_Time__c, Notes__c,Do_Not_Call__c from LeadBackup__c where RefID_FileNumber__c =:searchText  order by name];

       return null;
    }
    return null;
  }
  
  
  public PageReference save() {
   
   if(!(String.isEmpty(searchText))){
          
       try {
            
            list<LeadBackup__c> lstupdate = new list<LeadBackup__c>();
            
                 
             For(LeadBackup__c le:searchResults){
             
             //le.Id = lead.Id;
             le.RefID_FileNumber__c = searchResults[0].RefID_FileNumber__c ;
             le.Lead__c = [select name,id from lead where Ref_ID_File_Number__c=:searchtext ].id;
             le.Name = searchResults[0].Name;
             le.Email__c = searchResults[0].Email__c;
             le.Phone__c = searchResults[0].Phone__c;
             le.Evening_Phone__c = searchResults[0].Evening_Phone__c ;
             le.Preferred_Call_Time__c = searchResults[0].Preferred_Call_Time__c;
             le.Notes__c = searchResults[0].Notes__c;
             le.Do_Not_Call__c = searchResults[0].Do_Not_Call__c;
             le.TAB_Message__c = True;
             le.TAB_Time_stamp__c = System.now();
             lstupdate.add(le);
             }
             
             update lstupdate;
      
      ApexPages.addmessage(new ApexPages.message(ApexPages.severity.info,'Record <b>'+searchResults[0].Name+'</b> has been Updated'));
            
    } Catch (DMLException e) {
      ApexPages.addMessages(e);
      return null;
    }
   
    searchText='';
    searchResults.clear(); 
    return null;
       
  }
  else
  {
       ApexPages.addmessage(new ApexPages.message(ApexPages.severity.info,'Please enter REFID/FileNumber'));
  }
  
  return null;
 
}
  public PageReference cancel() {
       
       pageReference pg1 = new pageReference('/apex/siteupdatinglead');
       return(pg1.setredirect(true));
       
  }

}

 this is so far my test class which is covering only 19%

 

Also i'm getting an error System.Query exception on test run i showed it below

 

@isTest
private class TestsiteLead{

private static testmethod void testing(){

     PageReference pgRef = Page.siteupdatinglead;
     
     Test.setCurrentPage(pgRef);
      
     string searchtext='AS098-87658';
     
     User u1 = [select id,name from user where id=:UserInfo.getUserId()];
   
     Lead le = new Lead(Status='Mailed',  FirstName='wahed', LastName='testle',  
                       OwnerId=u1.Id, MobilePhone= '4695690396', Phone= '4695690397',Ref_ID_File_Number__c='AS098-87658',City='test city',
                       street='test street',state='test state',Evening_Phone__c='5648972315',Preferred_Call_Time__c=system.now(),
                       Notes__c ='test',DoNotCall=true );
     insert le;
    
     Leadbackup__c lb = new Leadbackup__c(Name='testbackup', Lead__c=le.id, Phone__c='9703046831',RefID_FileNumber__c='AS098-87658');
     insert lb;

     ApexPages.StandardController sc = new ApexPages.standardController(le);

     SiteLead SL = new SiteLead(sc);

     SL.search();-------Also i'm getting an error System.Query exception on test run
     
     Leadbackup__c lb1=[select id,name,phone__c from LeadBackup__c where id=:lb.id];
     lb1.Phone__c='4695690396';
     update lb1;
     
      SL.save();
      
      SL.cancel();

     
} 


}

 

Hi Everyone,

 

I have a custom field REFID__c on lead,leadbackup__c objects. i need to search the records according to this field.Whenever REFID exists in lead object and not in leadbackup then it should create a record with same refid,fields on lead into leadbackup and display the record in edit mode.

If it exits on both objects it simply display the record in edit mode. The lead object should use only for searching and to create record on leadbackup__c.

 

I'm getting this error

 

Visualforce Error


System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_UPDATE_CONVERTED_LEAD, cannot reference converted lead: []

Error is in expression '{!search}' in component <apex:page> in page siteupdatinglead


Class.SiteLead.search: line 33, column 1

 

My VF CODE

 

<apex:page standardController="LeadBackup__c" sidebar="false" extensions="SiteLead">
 <head>
    <style>
        .startStyle{
            font-size:12px;
            font-weight:bold;
            color:red;
        }     
    </style>
 </head>
  <apex:sectionHeader title="Lead Form" subtitle="New Lead" />
   <apex:form id="frm">
    <div style="width:1400px; padding-left:5%; ">
     <apex:pageBlock id="Block" mode="edit">
      <apex:pageBlockButtons location="both">
        <apex:commandButton action="{!save}" value="Save Records" rerender="frm"/>
        <apex:commandButton action="{!cancel}" value="Cancel"/>
      </apex:pageBlockButtons>
       <apex:pageMessages escape="false"/>
        <apex:pageBlockSection >
         <apex:pageblockSectionItem >
          <apex:outputLabel for="searchText" style="font-size:14px">RefID/FileNumber</apex:outputLabel>
          <apex:panelGroup >
          <apex:inputText id="searchText" value="{!searchText}"/>
          <apex:commandButton value="Search" action="{!search}" rerender="resultsBlock" status="status"/>
          </apex:panelGroup>
         </apex:pageblockSectionItem>
        </apex:pageBlockSection>
        
        <apex:actionStatus id="status" startText="Searching... please wait..."/>
      <apex:pageBlockSection title="Lead Results" id="resultsBlock" columns="1">
        <apex:pageBlockTable value="{!searchResults}" var="LeadBackup__c" rendered="{!NOT(ISNULL(searchResults))}">
          <apex:column headerValue="LeadName" width="100">
           <apex:inputField value="{!LeadBackup__c.Name}"/>
          </apex:column>
          <apex:column value="{!LeadBackup__c.Street__c}" headerValue="Street" width="100"/>
          <apex:column value="{!LeadBackup__c.City__c}" headerValue="City" width="100"/>
          <apex:column value="{!LeadBackup__c.State__c}" headerValue="State" width="100"/>
        
        <!--  <apex:column headerValue="First Name" width="100">
            <apex:inputField value="{!Lead.FirstName}"/>
          </apex:column>
          <apex:column headerValue="Last Name" width="100">
            <apex:inputField value="{!Lead.LastName}"/>
          </apex:column> -->
          
          <apex:column headerValue="Email" width="100" style="font-size:12px">
            <apex:inputField value="{!LeadBackup__c.Email__c}"/>
          </apex:column>
          <apex:column headerValue="Phone" width="100">
            <apex:inputField value="{!LeadBackup__c.Phone__c}"/>
          </apex:column>
          <apex:column headerValue="Evening Phone" width="100">
            <apex:inputField value="{!LeadBackup__c.Evening_Phone__c}"/>
          </apex:column>
          <apex:column headerValue="Preferred Call Time" width="100">
            <apex:inputField value="{!LeadBackup__c.Preferred_Call_Time__c}"/>
          </apex:column>
          <apex:column headerValue="Notes" width="100">
            <apex:inputField value="{!LeadBackup__c.Notes__c}"/>
          </apex:column>
          <apex:column headerValue="Do Not Call" width="100">
            <apex:inputField value="{!LeadBackup__c.Do_Not_Call__c}"/>
          </apex:column>
          
        </apex:pageBlockTable>
      </apex:pageBlockSection>
     </apex:pageBlock>
    </div> 
   </apex:form>
</apex:page>

 Controller:

 

public  class SiteLead {
    
    private ApexPages.StandardController controller {get; set;}
    public List<LeadBackup__c> searchResults {get;set;}
    public string searchText {get;set;}
    //public Lead Leads;
   
    
    public SiteLead(ApexPages.StandardController controller) {
    


    }
    
    List<Lead> Leads=[select id, name, FirstName, LastName, Status, Ref_ID_File_Number__c, Email, Phone, Street, City, State, Country, PostalCode, TAB_Message__c, Evening_Phone__c, Preferred_Call_Time__c, Notes__c,DoNotCall from Lead where Ref_ID_File_Number__c =:searchText ];
 
    
    public PageReference search() {
   // String qry = 'select id,Ref_ID_File_Number__c, Email__c, Phone__c, Street__c, City__c, State__c, TAB_Message__c, Evening_Phone__c, Preferred_Call_Time__c, Notes__c,DoNotCall__c from LeadBackup__c' + where Ref_ID_File_Number__c = searchText  order by name';
    searchResults = [select id,RefID_FileNumber__c,Name, Email__c, Phone__c, Street__c, City__c, State__c, TAB_Message__c, TAB_Time_stamp__c, Evening_Phone__c, Preferred_Call_Time__c, Notes__c,Do_Not_Call__c from LeadBackup__c where RefID_FileNumber__c =:searchText  order by name];
    //searchResults = Database.query(qry);
   
     
     //searchResults = [select id, name, FirstName, LastName, Status, Ref_ID_File_Number__c, Email, Phone, Street, City, State, Country, PostalCode, TAB_Message__c, Evening_Phone__c, Preferred_Call_Time__c, Notes__c,DoNotCall from Lead where Ref_ID_File_Number__c =:searchText  order by name];

   
    if(searchResults.size()==0){

          LeadBackup__c lb = new  LeadBackup__c(RefID_FileNumber__c = searchText,Name=Leads[0].Name, Lead__c = Leads[0].id, Email__c = Leads[0].Email, Phone__c = Leads[0].Phone,
                                                Evening_Phone__c = Leads[0].Evening_Phone__c, Preferred_Call_Time__c = Leads[0].Preferred_Call_Time__c, Notes__c = Leads[0].Notes__c,
                                                Do_Not_Call__c = Leads[0].DoNotCall);
          searchResults.add(lb);
          insert searchResults ;////////Error line
          
    }else{
    
       ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Info,'<b>Please confirm name and address below. Address will be where the letter was received/addressed. If these do not match, you will need to re-verify Ref ID, as it may have been entered incorrectly</b>'));
       return null;
    }
    return null;
  }
  
  
  public PageReference save() {
   
   if(!(String.isEmpty(searchText))){
          
       try {
            
            list<LeadBackup__c> lstupdate = new list<LeadBackup__c>();
            
                 
             For(LeadBackup__c le:searchResults){
             
             //le.Id = lead.Id;
             le.RefID_FileNumber__c = searchResults[0].RefID_FileNumber__c ;
             le.Lead__c = Leads[0].id;
             le.Name = Leads[0].Name;
             le.Email__c = Leads[0].Email;
             le.Phone__c = Leads[0].Phone;
             le.Evening_Phone__c = Leads[0].Evening_Phone__c ;
             le.Preferred_Call_Time__c = Leads[0].Preferred_Call_Time__c;
             le.Notes__c = Leads[0].Notes__c;
             le.Do_Not_Call__c = Leads[0].DoNotCall;
             le.TAB_Message__c = True;
             le.TAB_Time_stamp__c = System.now();
             lstupdate.add(le);
             }
             
             update lstupdate;
      
      ApexPages.addmessage(new ApexPages.message(ApexPages.severity.info,'Record <b>'+searchResults[0].Name+'</b> has been Updated'));
            
    } Catch (DMLException e) {
      ApexPages.addMessages(e);
      return null;
    }
   
    searchText='';
    searchResults.clear(); 
    return null;
       
  }
  else
  {
       ApexPages.addmessage(new ApexPages.message(ApexPages.severity.info,'Please enter REFID/FileNumber'));
  }
  
  return null;
 
}
  public PageReference cancel() {
       
       pageReference pg1 = new pageReference('/apex/siteupdatinglead');
       return(pg1.setredirect(true));
       
  }

}

 Please help me out in this regard, any help greatly appreciated..

Hi Everyone,

 

I want to develope a site which can be acceesed by 50 users want to know how to start and price for each user license....

 

Thanks in advance

I have a validation rule on lead object which is for our users to set them as owner for the lead.i written a trigger on task object to update the lead fields with task fields here i'm getting an error

 

activitycall2:execution of AfterInsert caused by: System.DmlException: Update failed. First exception on row 0 with id 00QE000000ExKxvMAF; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION.

 

how can i make my trigger free form this validation rule through Apex.

Hi Everyone,

 

I have 3 queues in my dev.org i want to find the present login user is member of which queue.how i can find this.Thanks in advance

HI Everyone,

 

I override my standard convert button with a VF page ,which will convert lead to account ,contact,opportunity through controller.i have three roles in my org which are 'salesrep','executive','manager'.I need it should execute (LEad conversion) only when

 

1)  Sales Rep can convert their own leads, and Lead owned by a Queue they are a member of

2) If Sales Rep converts a lead owned by a Queue , then change ownership Contact, Account, Opportunity to Sales Rep user who is converting.

3) Sales Manager and Executive can convert their teams' leads. If a Sales Manager or Executive converts a sales user's Lead, ownership of lead, opportunity, account and contact should remain sales rep

 

i'm using this code

 

 

Database.LeadConvert  lc =newdatabase.LeadConvert();

lc.setLeadId(lead.Id);

 

LeadStatus convertstatus = [select Id, MasterLabel from LeadStatus where IsConverted=true limit 1];

lc.setConvertedStatus(convertStatus.MasterLabel);

 

Database.LeadConvert[] lcArray =newDatabase.LeadConvert[] {lc};

Database.LeadConvertResult[] results = Database.convertLead(lcArray);

 

System.assert(results[0].IsSuccess());

 

 

Hi, i have a field called Charges__c which would be 0 when record is created.

After 24 hours of record creation charges__c should be updated to a value(assume 200 then 0+200 = 200).

Later after 48 hours charges__c should be updated to(200+200=400).
 
This cycle is repeated every 24 hours. Any Suggestions ? 
Is there any Rest API support for the chatter thanks badge?  Also Can you tell me how to post a badge using Apex code ?

Hi Everyone,

 

I want to pass my attachment body which i'm querying in the script to the javascript function

base64_decode (some base64variable).

Actually attachement body is of type Base64.

 

<script>
  var existingSel = document.getElementById('select_0');
  sforce.connection.sessionId = '{!$Api.Session_ID}';
 
  var qr = sforce.connection.query("Select Id,ParentId, Name,body,ContentType From Attachment where ParentId=:'0039000000InSjOAAV'") ;
  var records = qr.getArray(“records”)
 
  for (var i=0;i<qr.records.length;i++)
  {
   alert(qr.records[i].Body);
  }

  function base64_decode (some variable) {
 
 ////////////////// Some Logic Here==========================
}
</script>

Hi,

I'm haveing requriment like : There are two accounts A1 and A2,A1 having one open opportunity and A2 having one open opportunity when I try to merge A1 and A2 error should throws

 

for this i need to write trigger to merge account with conditions with custom button.

HI Experts,

 

Actually my requirment is that when lead is created with the startdate and endate right so i will assign this lead to some other one so when owner changes of lead so i want to find the days , between this time slot i mean between first owner of lead to second owner of the lead so please guide me how to do that.

 

 

 

Thans in advance

 

 

 

 

 

When a Quote is created from an Opporutnity , all the product line items gets copied over, including some standard fields like

 

Line Item Description

Quantity

Sales Price.

 

There is a COST field on OpportunityProduct, which also needs to get copied over to the Quote LIne Items.

 

I cannot do this using Formulas or WF Rule.

 

I think, Trigger can be done here.

 

Can some one please confirm this and guide me to right direction. ?

 

 

Thanks

sumita

 

 

 

Hi,

 

I have a situation to update the probability field with some other fields in opportunity object based on stage changes.

Like i have stage picklist values as A,B,C,D,E.

So when when mt stage is A i want to update probability with a Customfield1__c same for all stages.

Here i need to create different WFRs,is there any way to update probability for different stages in a single WFR.

 

 

Hi,

 

I created a flow which will updates a lead record based on a search field in lead,which is working good like,when i'm searching for lead it retrieves the record from lead and make some updates to that record too but i used this flow in a VF page and i used that VF page a site then i'm getting folloing error...

 

 I have this field notes__c on lead object but the error msg showing this    

 

Unhandled process fault from Gmail : Test_Flow_For_Lead_Update : interaction.dal.exception.DALExecutionFault: ; nested exception is: common.exception.ApiQueryException: SELECT Lead.Email, Lead.notes__c FROM Lead WHERE (Lead.Ref_ID_File_Number__c ^ ERROR at Row:1:Column:20 No such column 'notes__c' on entity 'Lead'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names. (There was a problem executing your command.) > RETRIEVE

 

 

Hi Everyone,

 

I have two buttons checkformat,search.I want to disable my search button untill user check for his format with checkformat button.I'm using a javascript to check the format of my inputtext.

 

Here is my code,

 

<apex:panelGroup >
          <apex:inputText id="searchText" value="{!searchText}" onblur="checkingstring(this)"/>
          <button onclick="alert('Correct Format !');">CheckFormat</button>         
          <apex:commandButton value="Search" action="{!search}" rerender="resultsBlock" status="status" disabled="true"/></apex:panelGroup>

 

<script>
function checkingstring(searchText){
    var regexp = /^[A-Z]{2}\d{4}-\d{5}$/i; //AANNNN-NNNNN A = Capital N = Number
    if (!regexp.exec(searchText.value)) {
        alert("The syntax is always as follows: AANNNN-NNNNN (A= Alpha/Letter; N= Number) i.e.FL0301-12345</b>");  
    }
}
</script>

 

 

for my search button it will search for the text on the object if it is not on object it will create a record with the searchtext and it will display thwe record in edit mode to update some of the values..if the record exists it will simply displays the record..

 

public pagereference search(){

 

/// code goes here

 

}

 

Search should be enable only when the text is in correct format....

 

 

Hi there,

 

I'm brand new in Apex and I never used any program to create triggers or class like Eclipse or others.

What I did it’s just create the trigger or class in my Sandbox using developer console and send to my production.

 

Doing this I never learned how to delete an trigger or class in my production and this is becoming too appears some problems to me.

 

Is there an easy way to delete triggers or class from my production that are messing me up?

 

Thanks !

Hello Everyone,

 

I want to check whether my one of inputtext field in a desired format or not ,in this case i'm getting the mentioned exception

 

Visualforce Error....Exception: Matcher is not serializable. 

 

i want my inputtext should be as   AANNNN-NNNNN (A= Alpha/Letter; N= Number) for eg: "AS1234-56789"

 

My Vf page:

 

<apex:page>

--------

<apex:panelGroup >
<apex:inputText id="searchText" value="{!searchText}"/>
<apex:commandButton value="Search" action="{!search}" rerender="resultsBlock" status="status"/>
</apex:panelGroup>

------------------------

</apex:page>

 

My controller:

 

i'm searching using matcher like this in my controller

 

 

Public class sitelead{

 

public string searchText {get;set;}

 

String REFIDRegex = '([a-zA-Z](2)[0-9](4)-[0-9](5))';
Pattern MyPattern = Pattern.compile(REFIDRegex);
Matcher MyMatcher = MyPattern.matcher(searchText);

 

}

 I have a inputtext  in my VF page  as

 

        <apex:pageBlockSection >
         <apex:pageblockSectionItem >
          <apex:outputLabel for="searchText" style="font-size:14px">RefID/FileNumber</apex:outputLabel>
          <apex:panelGroup >
          <apex:inputText id="searchText" value="{!searchText}"/>
          <apex:commandButton value="Search" action="{!search}" rerender="resultsBlock" status="status"/>
          </apex:panelGroup>
         </apex:pageblockSectionItem>
        </apex:pageBlockSection>

 

I'm using that text field in my controller to compare one of my text field in the LeadBackup__c object as

 

public PageReference search() {
   // String qry = 'select id,Ref_ID_File_Number__c, Email__c, Phone__c, Street__c, City__c, State__c, TAB_Message__c, Evening_Phone__c, Preferred_Call_Time__c, Notes__c,DoNotCall__c from LeadBackup__c' + where Ref_ID_File_Number__c = searchText  order by name';
    searchResults1 = [select id,RefID_FileNumber__c,Name, Email__c, Phone__c, Street__c, City__c, State__c, TAB_Message__c, TAB_Time_stamp__c, Evening_Phone__c, Preferred_Call_Time__c, Notes__c,Do_Not_Call__c from LeadBackup__c where RefID_FileNumber__c =:searchText  order by name];
    //searchResults = Database.query(qry);
   
     
     //searchResults = [select id, name, FirstName, LastName, Status, Ref_ID_File_Number__c, Email, Phone, Street, City, State, Country, PostalCode, TAB_Message__c, Evening_Phone__c, Preferred_Call_Time__c, Notes__c,DoNotCall from Lead where Ref_ID_File_Number__c =:searchText  order by name];

   
    if(searchResults1.size()==0){

          LeadBackup__c lb = new  LeadBackup__c(RefID_FileNumber__c = searchText,
                                                Name=[select name,id from lead where Ref_ID_File_Number__c=:searchtext ].Name,
                                                City__c=[select name,id,city from lead where Ref_ID_File_Number__c=:searchtext ].City,
                                                Street__c=[select name,id,street from lead where Ref_ID_File_Number__c=:searchtext ].street,
                                                State__c=[select name,id,state from lead where Ref_ID_File_Number__c=:searchtext ].state,
                                                Lead__c = [select name,id from lead where Ref_ID_File_Number__c=:searchtext ].id,
                                                Email__c = [select name,id,Email from lead where Ref_ID_File_Number__c=:searchtext ].Email,
                                                Phone__c = [select name,id,Email,Phone from lead where Ref_ID_File_Number__c=:searchtext].Phone,
                                                Evening_Phone__c = [select name,id,Evening_Phone__c  from lead where                 Ref_ID_File_Number__c=:searchtext ].Evening_Phone__c,
                                                Preferred_Call_Time__c = [select name,id,Evening_Phone__c,Preferred_Call_Time__c   from lead where Ref_ID_File_Number__c=:searchtext ].Preferred_Call_Time__c,
                                                Notes__c = [select name,id,Evening_Phone__c,Notes__c   from lead where Ref_ID_File_Number__c=:searchtext ].Notes__c,
                                                Do_Not_Call__c = [select name,id,Evening_Phone__c,DoNotCall   from lead where Ref_ID_File_Number__c=:searchtext ].DoNotCall);
          //searchResults.add(lb);
          system.debug('lb'+lb);
          insert lb ;
          
          searchResults = [select id,RefID_FileNumber__c,Name, Email__c, Phone__c, Street__c, City__c, State__c, TAB_Message__c, TAB_Time_stamp__c, Evening_Phone__c, Preferred_Call_Time__c, Notes__c,Do_Not_Call__c from LeadBackup__c where RefID_FileNumber__c =:searchText  order by name];

          
    }else{
    
       ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Info,'<b>Please confirm name and address below. Address will be where the letter was received/addressed. If these do not match, you will need to re-verify Ref ID, as it may have been entered incorrectly</b>'));
       
       searchResults = [select id,RefID_FileNumber__c,Name, Email__c, Phone__c, Street__c, City__c, State__c, TAB_Message__c, TAB_Time_stamp__c, Evening_Phone__c, Preferred_Call_Time__c, Notes__c,Do_Not_Call__c from LeadBackup__c where RefID_FileNumber__c =:searchText  order by name];

       return null;
    }
    return null;
  }
 
 
  public PageReference save() {
   
   if(!(String.isEmpty(searchText))){  -----------------From Here my code is not covering how to pass this search text in test class
          
       try {
            
            list<LeadBackup__c> lstupdate = new list<LeadBackup__c>();
            
                 
             For(LeadBackup__c le:searchResults){
             
             //le.Id = lead.Id;
             le.RefID_FileNumber__c = searchResults[0].RefID_FileNumber__c ;
             le.Lead__c = [select name,id from lead where Ref_ID_File_Number__c=:searchtext ].id;
             le.Name = searchResults[0].Name;
             le.Email__c = searchResults[0].Email__c;
             le.Phone__c = searchResults[0].Phone__c;
             le.Evening_Phone__c = searchResults[0].Evening_Phone__c ;
             le.Preferred_Call_Time__c = searchResults[0].Preferred_Call_Time__c;
             le.Notes__c = searchResults[0].Notes__c;
             le.Do_Not_Call__c = searchResults[0].Do_Not_Call__c;
             le.TAB_Message__c = True;
             le.TAB_Time_stamp__c = System.now();
             lstupdate.add(le);
             }
             
             update lstupdate;
      
      ApexPages.addmessage(new ApexPages.message(ApexPages.severity.info,'Record <b>'+searchResults[0].Name+'</b> has been Updated'));
            
    } Catch (DMLException e) {
      ApexPages.addMessages(e);
      return null;
    }
   
    searchText='';
    searchResults.clear();
    return null;
       
  }
  else
  {
       ApexPages.addmessage(new ApexPages.message(ApexPages.severity.info,'Please enter REFID/FileNumber'));
  }
 
  return null;
 
}

 

How to pass this search text to the test class ......

Any help would appreciated greatly...

 

 

I have a VF page which will search for records based on a string value REFID here is my controller please help me in this regard

 

public  class SiteLead {
    
    private ApexPages.StandardController controller {get; set;}
    public List<LeadBackup__c> searchResults {get;set;}
     public List<LeadBackup__c> searchResults1 {get;set;}
    public string searchText {get;set;}
    //public Lead Leads;
   
    
    public SiteLead(ApexPages.StandardController controller) {
    


    }
    
    List<Lead> Leads=[select id, name, FirstName, LastName, Status, Ref_ID_File_Number__c, Email, Phone, Street, City, State, Country, PostalCode, TAB_Message__c, Evening_Phone__c, Preferred_Call_Time__c, Notes__c,DoNotCall from Lead where Ref_ID_File_Number__c =:searchText AND IsConverted=false ];
    
    public PageReference search() {
   // String qry = 'select id,Ref_ID_File_Number__c, Email__c, Phone__c, Street__c, City__c, State__c, TAB_Message__c, Evening_Phone__c, Preferred_Call_Time__c, Notes__c,DoNotCall__c from LeadBackup__c' + where Ref_ID_File_Number__c = searchText  order by name';
    searchResults1 = [select id,RefID_FileNumber__c,Name, Email__c, Phone__c, Street__c, City__c, State__c, TAB_Message__c, TAB_Time_stamp__c, Evening_Phone__c, Preferred_Call_Time__c, Notes__c,Do_Not_Call__c from LeadBackup__c where RefID_FileNumber__c =:searchText  order by name];
    //searchResults = Database.query(qry);
   
     
     //searchResults = [select id, name, FirstName, LastName, Status, Ref_ID_File_Number__c, Email, Phone, Street, City, State, Country, PostalCode, TAB_Message__c, Evening_Phone__c, Preferred_Call_Time__c, Notes__c,DoNotCall from Lead where Ref_ID_File_Number__c =:searchText  order by name];

   
    if(searchResults1.size()==0){

          LeadBackup__c lb = new  LeadBackup__c(RefID_FileNumber__c = searchText, 
                                                Name=[select name,id from lead where Ref_ID_File_Number__c=:searchtext ].Name,
                                                City__c=[select name,id,city from lead where Ref_ID_File_Number__c=:searchtext ].City,
                                                Street__c=[select name,id,street from lead where Ref_ID_File_Number__c=:searchtext ].street,
                                                State__c=[select name,id,state from lead where Ref_ID_File_Number__c=:searchtext ].state,
                                                Lead__c = [select name,id from lead where Ref_ID_File_Number__c=:searchtext ].id, 
                                                Email__c = [select name,id,Email from lead where Ref_ID_File_Number__c=:searchtext ].Email, 
                                                Phone__c = [select name,id,Email,Phone from lead where Ref_ID_File_Number__c=:searchtext ].Phone,
                                                Evening_Phone__c = [select name,id,Evening_Phone__c  from lead where Ref_ID_File_Number__c=:searchtext ].Evening_Phone__c, 
                                                Preferred_Call_Time__c = [select name,id,Evening_Phone__c,Preferred_Call_Time__c   from lead where Ref_ID_File_Number__c=:searchtext ].Preferred_Call_Time__c, 
                                                Notes__c = [select name,id,Evening_Phone__c,Notes__c   from lead where Ref_ID_File_Number__c=:searchtext ].Notes__c,
                                                Do_Not_Call__c = [select name,id,Evening_Phone__c,DoNotCall   from lead where Ref_ID_File_Number__c=:searchtext ].DoNotCall);
          //searchResults.add(lb);
          system.debug('lb'+lb);
          insert lb ;
          
          searchResults = [select id,RefID_FileNumber__c,Name, Email__c, Phone__c, Street__c, City__c, State__c, TAB_Message__c, TAB_Time_stamp__c, Evening_Phone__c, Preferred_Call_Time__c, Notes__c,Do_Not_Call__c from LeadBackup__c where RefID_FileNumber__c =:searchText  order by name];

          
    }else{
    
       ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Info,'<b>Please confirm name and address below. Address will be where the letter was received/addressed. If these do not match, you will need to re-verify Ref ID, as it may have been entered incorrectly</b>'));
       
       searchResults = [select id,RefID_FileNumber__c,Name, Email__c, Phone__c, Street__c, City__c, State__c, TAB_Message__c, TAB_Time_stamp__c, Evening_Phone__c, Preferred_Call_Time__c, Notes__c,Do_Not_Call__c from LeadBackup__c where RefID_FileNumber__c =:searchText  order by name];

       return null;
    }
    return null;
  }
  
  
  public PageReference save() {
   
   if(!(String.isEmpty(searchText))){
          
       try {
            
            list<LeadBackup__c> lstupdate = new list<LeadBackup__c>();
            
                 
             For(LeadBackup__c le:searchResults){
             
             //le.Id = lead.Id;
             le.RefID_FileNumber__c = searchResults[0].RefID_FileNumber__c ;
             le.Lead__c = [select name,id from lead where Ref_ID_File_Number__c=:searchtext ].id;
             le.Name = searchResults[0].Name;
             le.Email__c = searchResults[0].Email__c;
             le.Phone__c = searchResults[0].Phone__c;
             le.Evening_Phone__c = searchResults[0].Evening_Phone__c ;
             le.Preferred_Call_Time__c = searchResults[0].Preferred_Call_Time__c;
             le.Notes__c = searchResults[0].Notes__c;
             le.Do_Not_Call__c = searchResults[0].Do_Not_Call__c;
             le.TAB_Message__c = True;
             le.TAB_Time_stamp__c = System.now();
             lstupdate.add(le);
             }
             
             update lstupdate;
      
      ApexPages.addmessage(new ApexPages.message(ApexPages.severity.info,'Record <b>'+searchResults[0].Name+'</b> has been Updated'));
            
    } Catch (DMLException e) {
      ApexPages.addMessages(e);
      return null;
    }
   
    searchText='';
    searchResults.clear(); 
    return null;
       
  }
  else
  {
       ApexPages.addmessage(new ApexPages.message(ApexPages.severity.info,'Please enter REFID/FileNumber'));
  }
  
  return null;
 
}
  public PageReference cancel() {
       
       pageReference pg1 = new pageReference('/apex/siteupdatinglead');
       return(pg1.setredirect(true));
       
  }

}

 this is so far my test class which is covering only 19%

 

Also i'm getting an error System.Query exception on test run i showed it below

 

@isTest
private class TestsiteLead{

private static testmethod void testing(){

     PageReference pgRef = Page.siteupdatinglead;
     
     Test.setCurrentPage(pgRef);
      
     string searchtext='AS098-87658';
     
     User u1 = [select id,name from user where id=:UserInfo.getUserId()];
   
     Lead le = new Lead(Status='Mailed',  FirstName='wahed', LastName='testle',  
                       OwnerId=u1.Id, MobilePhone= '4695690396', Phone= '4695690397',Ref_ID_File_Number__c='AS098-87658',City='test city',
                       street='test street',state='test state',Evening_Phone__c='5648972315',Preferred_Call_Time__c=system.now(),
                       Notes__c ='test',DoNotCall=true );
     insert le;
    
     Leadbackup__c lb = new Leadbackup__c(Name='testbackup', Lead__c=le.id, Phone__c='9703046831',RefID_FileNumber__c='AS098-87658');
     insert lb;

     ApexPages.StandardController sc = new ApexPages.standardController(le);

     SiteLead SL = new SiteLead(sc);

     SL.search();-------Also i'm getting an error System.Query exception on test run
     
     Leadbackup__c lb1=[select id,name,phone__c from LeadBackup__c where id=:lb.id];
     lb1.Phone__c='4695690396';
     update lb1;
     
      SL.save();
      
      SL.cancel();

     
} 


}

 

Hi Everyone,

 

I want to develope a site which can be acceesed by 50 users want to know how to start and price for each user license....

 

Thanks in advance

I have a validation rule on lead object which is for our users to set them as owner for the lead.i written a trigger on task object to update the lead fields with task fields here i'm getting an error

 

activitycall2:execution of AfterInsert caused by: System.DmlException: Update failed. First exception on row 0 with id 00QE000000ExKxvMAF; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION.

 

how can i make my trigger free form this validation rule through Apex.

I want to be able to create a record when this flow is ran (under a certain critieria) but i also want to be able to pull across all the information that has been inputted into the flow by the customer into the custom object record in Salesforce.

 

I am new to this Cloud based workflow designer and i have made the flow in terms of decisions and screens but need a hand in connecting that with the object in salesforce

 

Any help would be greatly appreciated.

 

Many Thanks

 

Natalie White