• k sfdc
  • NEWBIE
  • 9 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 26
    Questions
  • 36
    Replies
Hi,
 Click a button How to call  a new popup window  and in the popup browser window, how to disable the address bar ?

help me...
  • November 01, 2014
  • Like
  • 0
ERROR:
First error: SendEmail failed. First exception on row 1; first error: MASS_MAIL_LIMIT_EXCEEDED, Failed to send email

Batch class:
------------------

global class MyBatchClass implements Database.Batchable<sObject>   {     global Database.QueryLocator start(Database.BatchableContext bc)     {     
   Date d= Date.today();        
 String soqlQuery = 'SELECT id,name,Owner.Email,Owner.Name,Expiry_Date__c FROM Account WHERE Expiry_Date__c < :d';         return Database.getQueryLocator(soqlQuery);   
  }      
  global void execute(Database.BatchableContext bc, List<Account> accountList)
    {   
      List<Messaging.SingleEmailMessage> mailList = new List<Messaging.SingleEmailMessage>();
        for(Account acc: accountList)  
       {       
      List<String> toAddresses = new List<String>();      
       Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
       toAddresses.add(acc.Owner.Email);
        mail.setToAddresses(toAddresses);       
      mail.setSubject('Welcome to Sweet 16 Siebel Batch');
     String messageBody = '<html><body>Hi ' + acc.Name + ',<br>Your account Expires today. <br>Kindly contact your administrator.<br><br><b>Regards,</b><br>Mahesh k</body></html>';         
    mail.setHtmlBody(messageBody);     
       mailList.add(mail);      
       }       
  Messaging.sendEmail(mailList);  
   }      
  global void finish(Database.BatchableContext bc)     {     } }
Schedule Class:
------------------------

global class ScheduleBatchClassForSendEmail implements Schedulable{       
 global void execute(SchedulableContext sc) {
         MyBatchClass schedulejob = new  MyBatchClass();        
   database.executebatch(schedulejob);      }  }




 
  • October 20, 2014
  • Like
  • 0
Hi,

Suppose i will go and search fields of description value as like "name"(ORIGINALTEXTDescription value is:Himynameisrajesh).I want display with in the table column value as  " hi..name......sh " .HOW?

page:
-------
<apex:page controller="Mycontroller">

<apex:form>
<apex:commandButton value="Search" action="{!Search}"
<table width="100%" align="center">
    
         <tr>
             
                                           
                <td>
                    <apex:inputField value="{!Object.Name}"/>
                </td>
               
               <td>
                    <apex:inputField value="{!Object.Description}"/>
               </td>
         </tr>
</table>

<apex:outputpanel rendered="{!isBoolean}" id="results">
<table width="100%" align="left">
  <tr>
  <th>Name</th>&nbsp;&nbsp;&nbsp;
   <th>Description</th>

  </tr>

  </tr>
     <apex:repeat value="{!listRecords}" var="lr">
           <tr>
  <td>{!lr.wrapmyobjectSave.Name}</td>
   <td>{!lr.wrapmyobjectSave.Description__C}</td>

  </tr>

</table>


</apex:outputpanel>

</apex:form>
</apex:page>

Controller:
--------------

public class Mycontroller
{
  public Myobject__c Object{get; set;}

public Boolean isBoolean{get;set;}

public ApexPages.StandardSetController con {
        get {
                if(con == null) {
              
                    con = new ApexPages.StandardSetController(Database.getQueryLocator([SELECT Id,Name,Description__C FROM Myobject__C]));
                                      
                }
                return con;
        }
        set;
    }

public List<SearchWrapper> getlistRecords(){
     
      List<SearchWrapper> SearchWrapperlist = new List<SearchWrapper>();
       
  
        for(Sobject iterateObject : con.getRecords())
        {
        
      String s1 = String.valueOf(iteraeObject.get('Description__c'));
       
     
      String strdescription = '';
          strdescription = s1.substring(ss.IndexOf(Object.Description__c)-5,s1.IndexOf(Object.Description__c)-2);
     
       strdescription = '';
          strdescription += '...';
         
         
       strdescription = '';
           strdescription += Object.Description__c;
          
          
       strdescription = '';
           strdescription += '...';
         
          
       strdescription = '';
           strdescription += s1.substring(ss.IndexOf(Object.Description__c)+3 , s1.IndexOf(Object.Legal_Description__c)+5);
     
      System.debug('****strdescription*****'+strdescription);
                 
           SearchWrapperlist .add(new SearchWrapper((Myobject__C)iterateObject,strdescription));
        }
        return SearchWrapperlist;
    }
   

public pageReference Search()
{

isBoolean=true;
  strQuery = 'SELECT Id,Name,Description__C FROM Myobject__C';
  if( Object.Name !=NULL || Object.Description__C != NULL)
  {
    strQuery += 'WHERE ';

  }
  if(Object.Name != NULL){
            strQuery += 'Name =\'' + Object.Name + '\' AND ' ;
        }
     
        if(Object.Description__C != NULL){
            strQuery += 'Description__C  LIKE \'%'+Object.Description__C +'%\' AND' ;
        }

}


strQuery = strQuery.substring(0, strQuery.length()-4);
  con = new ApexPages.StandardSetController(Database.getQueryLocator(strQuery));

                 

}

public class SearchWrapper
     {
       public Myobject__C wrapmyobjectSave{get; set;}
      
       public String strdescription{get; set;}
      
       public SearchWrapper(Myobject__c wrapDropboxPDFSave, String strdescription)
       {
         this.wrapmyobjectSave=wrapmyobjectSave;
         this.strdescription=strdescription;      
       }
           
     }
    
NOTE:Suppose i will go and search fields of description as like "name"(ORIGINALTEXT:Himynameisrajesh).I want display with in the table column value as  " hi..name......sh " .HOW?
please help me...........

ERROR:strlegaldescription = ss.substring(ss.IndexOf(Object.Description__c)-4,ss.IndexOf(Object.Description__c)-1);
                strdescription += s1.substring(ss.IndexOf(Object.Description__c)+3 , s1.IndexOf(Object.Legal_Description__c)+5);

please help me...........
  • October 09, 2014
  • Like
  • 0
My page:
------------
<apex:page controller="MonthYearpicklistcontroller">
  <apex:form >
  <apex:pageBlock >
  <apex:selectList size="1" value="{!myDateRange}">
     <apex:selectOptions value="{!DateRangeOptions}"/>
     <apex:actionSupport event="onchange" reRender="out1"/>
</apex:selectList>
<apex:commandButton value="Go" action="{!doAction}" />
<apex:pageBlockSection rendered="{!isBoolean}">
          <ul>
        <apex:outputLabel value="Account:">
        <apex:repeat value="{!accounts}" var="account">
       
            <li>
                {!account.Name}
               
                <ul>
                <apex:outputLabel value="Opportunity:">
                <apex:repeat value="{!account.children}" var="opportunity">
                    <li>
                        {!opportunity.Name}
                        
                        <ul>
                        <apex:outputLabel value="Contact:">
                        <apex:repeat value="{!opportunity.children}" var="contact">
                            <li>
                                {!contact.Name}
                            </li>
                        </apex:repeat>
                        </apex:outputLabel>
                        </ul>
                        
                    </li>
                </apex:repeat>
                </apex:outputLabel>
                </ul>
                
            </li>
        </apex:repeat>
        </apex:outputLabel>
        </ul>
       

</apex:pageBlockSection>
  </apex:pageBlock>
  </apex:form>
</apex:page>

My Controller:
----------------

public class MonthYearpicklistcontroller {
    public Boolean isBoolean { get; set; }
    public String myDateRange { get; set; }
   
    public List<SelectOption> getDateRangeOptions() {

        List<SelectOption> options = new List<SelectOption>();
        options.add(new SelectOption('1-2014','Jan-2014'));
        options.add(new SelectOption('2-2014','Feb-2014'));
        options.add(new SelectOption('3-2014','Mar-2014')); `enter code here`
        options.add(new SelectOption('4-2014','Apr-2014'));
        options.add(new SelectOption('5-2014','May-2014'));
        options.add(new SelectOption('6-2014','june-2014'));
        options.add(new SelectOption('7-2014','july-2014')); 
        options.add(new SelectOption('8-2014','Aug-2014'));
        options.add(new SelectOption('9-2014','Sep-2014'));
        options.add(new SelectOption('10-2014','Oct-2014'));
           return options; 
    }
     public List<Wrapper> accounts{
        get
        {
         
       
            List<Wrapper> accounts = new List<Wrapper>();
            List<Id> oppIds = new List<Id>();
            for(Account acc : [Select Id, Name, (Select Id, Name From Opportunities) From Account])
            {
                Wrapper account = new Wrapper();
                account.Id = acc.Id;
                account.Name = acc.Name;
                account.children = new List<Wrapper>();
                accounts.add(account);
                for(Opportunity opp : acc.Opportunities)
                {
                    Wrapper opportunity = new Wrapper();
                    opportunity.Id = opp.Id;
                    opportunity.Name = opp.Name;
                    opportunity.children = new List<Wrapper>();
                    account.children.add(opportunity);
                    oppIds.add(opp.Id);
                }
            }
            Map<Id, Opportunity> oppMap = new Map<Id, Opportunity>([Select Id, (Select Id, Contact.Name From OpportunityContactRoles) From Opportunity where id In :oppIds]);
            for(Wrapper account : accounts)
            {
                for(Wrapper opportunity : account.children)
                {
                    for(OpportunityContactRole opCR : oppMap.get(opportunity.Id).OpportunityContactRoles)
                    {
                        Wrapper contact = new Wrapper();
                        contact.Id = opCR.Id;
                        contact.Name = opCr.Contact.Name;
                        opportunity.children.add(contact);
                    }
                }
            }
            return accounts;
        }
    }
   
   
     public PageReference doAction() {
     isBoolean =true;
        return null;
    }
   
     public class Wrapper{
        public Id Id{get;set;}
        public String Name{get;set;}
        public List<Wrapper> children{get;set;}
    }

}

How to display based on picklist month and date related records?

please help me......
  • October 05, 2014
  • Like
  • 0
Hi,
       I have one  Cancel__c(checkbox) on  custom object.Whenever this checkbox gets checked, a trigger should fire and update the Discount percentage field to 70% How?

please help me.....
  • October 02, 2014
  • Like
  • 0

Hi,
         Through URL i was get Contactid,using this contactid how to get related opportunity fields?

please help me.......
  • September 30, 2014
  • Like
  • 0
How to get System MAC Address Using Apex in salesforce?

please help me................
  • September 30, 2014
  • Like
  • 1
Hi,
       trigger Trg_onContact on Contact (before insert, before update) {

List<ID> accountIds=new List<ID>();

for(Contact con:Trigger.New)
{
  if(con.Email != null && con.AccountId !=null)
  {
   accountIds.add(con.AccountId);
  }
}
List<Contact> contactList=[SELECT Email FROM Contact WHERE Id IN : accountIds];
List<Account> accountList=[SELECT Name,Email__C FROM Account WHERE Id IN :accountIds];

for(Integer i=0; i < accountList.size(); i++)
{
  String Email = ''+ contactList[0].get('Email');
  accountList[i].Email__C=Email;
 
}

update accountlist;

System.debug('***accountlist****'+accountlist);

}

please help me...........
  • September 29, 2014
  • Like
  • 0
Hi,
          how to display account contact and opportunity records as hierarchy using apex in salesforce like below

Account
     ----> Opportunity
            ----- >Contact
  • September 29, 2014
  • Like
  • 0


Hi,
       When updating / inserting contact, have the below check if an account doesnt have email populated, assign contact email into Account email.

Please help me.........
  • September 26, 2014
  • Like
  • 0
public class LoginController {

    public PageReference doUsername() {
   
    pageReference ref=new pageReference('/apex/usernamepage');
        return ref.setRedirect(true);
    }


    public String password { get; set; }

    public String username { get; set; }
   
    public List<objject__c> lstcon{get; set;}
 
    public LoginController()
    {
    lstcon=new List<object__c>();
    }

    public PageReference login() {
       
     try{
            Contact con = [Select id, username__c, password__c from object__c
                                    where username__c=:username AND password__C=:password];
                                  
                               
           
            if(password == con.Password__c  && username == con.username__C ){
                pagereference ref = new pagereference('/apex/Fieldssearchpage?conid='+con.id);          
                     return ref.setRedirect(true);
            }
            else {
                ApexPages.Message msg = new ApexPages.Message(ApexPages.Severity.Fatal,'Invalid Credentials..');
                ApexPages.addMessage(msg);
            }
        
   }    
       
        catch(exception e){
            ApexPages.Message msg = new ApexPages.Message(ApexPages.Severity.Fatal,'No Record Exists in our database...');
            ApexPages.addMessage(msg);
       
    }   
        return null;
    }

}

please help me.............
  • September 11, 2014
  • Like
  • 0
public pageReference doSearch()
    {
        System.debug('***dbPDF***'+dbPDF);
       
    display=true;
        String strQuery = 'SELECT Name, Accountnumber__c, Phone, Fax FROM Account ';
       
       // Date onOrAfterDate  = dbPDF.Instrument_Date__c;
       // Date onOrBeforeDate = con.Birthdate;
       
       
       
         if(dbPDF.name != null || dbPDF.Accountnumber__c != NULL || dbPDF.Phone != NULL || dbPDF.Fax  != NULL){
            strQuery += 'WHERE ';
        }
       
        if(dbPDF.Accountnumber__c != NULL){
            strQuery += 'name =\'' + dbPDF.name + '\' AND ' ;
        }
       
        if(dbPDF.Accountnumber__c != NULL){
            strQuery += 'Accountnumber__c =\'' + dbPDF.Accountnumber__c + '\' AND ' ;
        }
       
        if(dbPDF.Fax != NULL){
            strQuery += 'Fax  =\'' + dbPDF.Fax  + '\' AND ' ;
        }
       
        if(dbPDF.Phone != NULL){
            strQuery += 'Phone  =\''+dbPDF.Phone+ '\'AND ';
        }
  
       
       
         strQuery = strQuery.substring(0, strQuery.length()-4);
          System.debug('!!! '+strQuery);
         
             
            records = Database.query(strQuery);
                   
                    
        return null;
     }

How to add above code in below  controller code

Mypage:
--------

<apex:page controller="pagingControllerForUser1">
    <apex:form >
        <apex:pageBlock >
           
            <apex:pageMessages id="pgm"/>
           
            <apex:pageBlockButtons >
                <apex:commandButton value="Search" action="{!Search}"/>
            </apex:pageBlockButtons>
           
            <apex:pageBlockSection >
                 <apex:inputField value="{!dbPDF.name}"/>
                 <apex:inputField value="{!dbPDF.phone}"/>
                 <apex:inputField value="{!dbPDF.Fax}"/>
                <apex:inputField value="{!dbPDF.Accountnumber__c}"/>
               
 
                <!-- <apex:inputField value="{!con.Birthdate}" label="On or Before"/>-->
   
            </apex:pageBlockSection>

        </apex:pageBlock>

        <apex:pageBlock rendered="{!IF(AllSearchUsers.size != null && AllSearchUsers.size > 0, true , false)}">
                    <apex:outputPanel layout="block" styleClass="pSearchShowMore" id="otpNav2">
              Total Records Found: <apex:outputText rendered="{!IF(Con.resultSize==10000,true,false)}">10000 +</apex:outputText><apex:outputText rendered="{!IF(Con.resultSize < 10000,true,false)}">{!Con.resultSize}</apex:outputText>
                  <apex:image url="/img/search_prevarrow_disabled.gif" styleClass="prevArrow" rendered="{!NOT(Con.HasPrevious)}"/>
                  <apex:image url="/img/search_prevarrow.gif" title="Previous Page" styleClass="prevArrow" rendered="{!Con.HasPrevious}"/>
                  <apex:commandLink action="{!Previous}" title="Previous Page" value="Previous Page" rendered="{!Con.HasPrevious}"/>
                  <apex:outputPanel styleClass="pShowLess noLink" style="color:grey" rendered="{!NOT(Con.HasPrevious)}">Previous Page</apex:outputPanel>        
                  &nbsp;({!IF(Con.PageNumber == 1,1,((Con.PageNumber -1) * Con.PageSize)+1)}-{!IF(Con.resultSize < Con.PageSize,Con.resultSize,Con.PageNumber * Con.pageSize)})&nbsp;
                  <apex:outputPanel styleClass="pShowLess noLink" style="color:grey" rendered="{!NOT(Con.HasNext)}">Next Page</apex:outputPanel>        
                  <apex:commandLink title="Next Page" value="Next Page" rendered="{!Con.HasNext}" action="{!Next}"/>&nbsp;
                  <apex:image url="/img/search_nextarrow.gif" title="Next Page" styleClass="nextArrow" rendered="{!Con.HasNext}"/>
                  <apex:image url="/img/search_nextarrow_disabled.gif" rendered="{!NOT(Con.HasNext)}"/>         
              </apex:outputPanel>
           
           <apex:pageBlockSection columns="1">
               <apex:pageBlockTable var="UR" value="{!AllSearchUsers}" id="pbTable">
                <apex:column value="{!UR.Name}" />
                <apex:column headerValue="Accountnumber">
                    <apex:commandLink value="{!UR.Accountnumber__c}" action="{!displayFields}">
                        <apex:param name="RecordId Id" value="{!UR.Id}" assignTo="{!RecordId}"/>
                    </apex:commandlink>
                </apex:column>
                <apex:column value="{!UR.phone}" />
                <apex:column value="{!UR.Fax}" />
             
               
            </apex:pageBlockTable>
            </apex:pageBlockSection>
            <apex:outputPanel layout="block" styleClass="pSearchShowMore" id="otpNav">
              Total Records Found: <apex:outputText rendered="{!IF(Con.resultSize==10000,true,false)}">10000 +</apex:outputText><apex:outputText rendered="{!IF(Con.resultSize < 10000,true,false)}">{!Con.resultSize}</apex:outputText>
                  <apex:image url="/img/search_prevarrow_disabled.gif" styleClass="prevArrow" rendered="{!NOT(Con.HasPrevious)}"/>
                  <apex:image url="/img/search_prevarrow.gif" title="Previous Page" styleClass="prevArrow" rendered="{!Con.HasPrevious}"/>
                  <apex:commandLink action="{!Previous}" title="Previous Page" value="Previous Page" rendered="{!Con.HasPrevious}"/>
                  <apex:outputPanel styleClass="pShowLess noLink" style="color:grey" rendered="{!NOT(Con.HasPrevious)}">Previous Page</apex:outputPanel>        
                  &nbsp;({!IF(Con.PageNumber == 1,1,((Con.PageNumber -1) * Con.PageSize)+1)}-{!IF(Con.resultSize < Con.PageSize,Con.resultSize,Con.PageNumber * Con.pageSize)})&nbsp;
                  <apex:outputPanel styleClass="pShowLess noLink" style="color:grey" rendered="{!NOT(Con.HasNext)}">Next Page</apex:outputPanel>        
                  <apex:commandLink title="Next Page" value="Next Page" rendered="{!Con.HasNext}" action="{!Next}"/>&nbsp;
                  <apex:image url="/img/search_nextarrow.gif" title="Next Page" styleClass="nextArrow" rendered="{!Con.HasNext}"/>
                  <apex:image url="/img/search_nextarrow_disabled.gif" rendered="{!NOT(Con.HasNext)}"/>         
              </apex:outputPanel>

        </apex:pageBlock>

    </apex:form>
</apex:page>

Example   Controller:
--------------------------------

public class pagingControllerForUser
{
    public List<Account> AllSearchUsers
    {
        get
        {
            if(con != null)
                return (List<Account>)con.getRecords();
            else
                return null ;
        }
        set;}
   
    public Account usr {get; set;}
   
    //Controller
    public pagingControllerForUser()
    {
        AllSearchUsers = new List<Account>() ;
        usr = new Account() ;
    }
   
     public PageReference Search()
    {  
        if(usr.Name != null)
        {
            con = new ApexPages.StandardSetController(Database.getQueryLocator([select Id , name , phone,Fax from Account where name = :usr.Name]));

            // sets the number of records in each page set
            con.setPageSize(25);
        }
        else
        {
            con = null;
        }
        return null ;
    }
   
    //Instantiate the StandardSetController
    public ApexPages.StandardSetController con{get; set;}
   
    //Boolean to check if there are more records after the present displaying records
    public Boolean hasNext
    {
        get
        {
            return con.getHasNext();
        }
        set;
    }

    //Boolean to check if there are more records before the present displaying records
    public Boolean hasPrevious
    {
        get
        {
            return con.getHasPrevious();
        }
        set;
    }

    //Page number of the current displaying records
    public Integer pageNumber
    {
        get
        {
            return con.getPageNumber();
        }
        set;
    }

    //Returns the previous page of records
    public void previous()
    {
        con.previous();
    }

    //Returns the next page of records
    public void next()
    {
        con.next();
    }
}


Note:In above page is my visualforce page controller i get from Google

How to add My  doSearch() in above controller?



please help me.......
  • September 07, 2014
  • Like
  • 0
Hi,
        I displayed all records with in the pageblock table.In this pageblock table i gave one column as a Commandlink, when user click this command link ,how to display detail page for that record(customly like output fields)?

please help me....
  • September 07, 2014
  • Like
  • 0
How to get System MAC Address Using Apex in salesforce?

please help me................
  • September 30, 2014
  • Like
  • 1
Hi,
 Click a button How to call  a new popup window  and in the popup browser window, how to disable the address bar ?

help me...
  • November 01, 2014
  • Like
  • 0
Hi,
       I have one  Cancel__c(checkbox) on  custom object.Whenever this checkbox gets checked, a trigger should fire and update the Discount percentage field to 70% How?

please help me.....
  • October 02, 2014
  • Like
  • 0
How to get System MAC Address Using Apex in salesforce?

please help me................
  • September 30, 2014
  • Like
  • 1
Hi,
       trigger Trg_onContact on Contact (before insert, before update) {

List<ID> accountIds=new List<ID>();

for(Contact con:Trigger.New)
{
  if(con.Email != null && con.AccountId !=null)
  {
   accountIds.add(con.AccountId);
  }
}
List<Contact> contactList=[SELECT Email FROM Contact WHERE Id IN : accountIds];
List<Account> accountList=[SELECT Name,Email__C FROM Account WHERE Id IN :accountIds];

for(Integer i=0; i < accountList.size(); i++)
{
  String Email = ''+ contactList[0].get('Email');
  accountList[i].Email__C=Email;
 
}

update accountlist;

System.debug('***accountlist****'+accountlist);

}

please help me...........
  • September 29, 2014
  • Like
  • 0
Hi,
          how to display account contact and opportunity records as hierarchy using apex in salesforce like below

Account
     ----> Opportunity
            ----- >Contact
  • September 29, 2014
  • Like
  • 0

 

 

Position Name    :         Senior Software Engineer - Salesforce.com

 

Experience           :         Must have 1 to 2 years of experience in Salesforce.com Projects.

                                           Must be well versed with Apex Programming/ Visual Force/  Apex Triggers.

                                           Must have experience in using webservices.

                                           Must have very good skills in jquery and PHP programming.

 

                                           Must have very good written and oral communication skills. 

 

Job Location         :        Chennai, India.

 

 

Apply with your latest resume.

 

Hello,

 

I have the following line of code in my VF page:

 

            <apex:commandButton value="Generate PDF" action="{!URLFOR($Page.AcctPlanPDF,null,[Id=Account_Plan__c.id])}" style="background:#99CCFF; font-weight=bold"/>

I would like this to open a pop-up window to the AcctPlanPDF page when the button is clicked.  Does anyone know how to accomplish this while maintaining the commandButton?  Thanks.

  • October 23, 2012
  • Like
  • 0