• suneel rao
  • NEWBIE
  • 40 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 9
    Questions
  • 7
    Replies
Hi all,
I want to validate the custom check box before submitting Force.com sites custom vfpage. Can we use standard validation over here...? because i want to make the check box as mandetory. how can we achive this. Can anyone help me over here.

Thanks in advance.
regards,
Suneel.
Hi all,
Can any help me how to write the method to genrate the pdf and send it email to the given email in the application form when save button is clicked.
Hi all,
I want  to send an email with PDF attachment when an submit button is clicked in my custom vfpage. Can any one help over here.

Regards,
Suneel.
Hi all,
I want to download the PDF in the new tab when a button in custom vfpage is clicked. Can anyone help me over here.
Hi eveyone,
I want to remove the default '--None--' value form the picklist field in my custom vfpage. I have used the script to remove none form the picklist filed.
<script type='text/javascript' src= '//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js'>
        </script>
        <script language="javascript">
            $(function() {       
                $('select.RemoveNone option[value=]').remove();    
                  $(".usstates").hide(); 
                  
            });
        </script>

But it's not removing for custom fields. Can any one help me over here.

regards,
Suneel.
Hi all,
I have two custom vfpages, in the first page i have address fields. After filling the data when we click the next button we will redirecting to second page in this page i have a field with the picklist values Yes and No. If we select Yes then the previous address fileds should be shown and if you select No show the empty address fields to enter data.
Can anyone help me over here. I was new to this task.

regards,
Suneel.
Hi all,
Can anyone help me in writting test class for this.

public class Ugcontroller {

    public String getBirthdateDOW() {
        return null;
    }


    public PageReference FindBirthdateDOW() {
        return null;
    }


 public String selectedyear{get;set;}
 public Date dat{get;set;}
 public ID ugId{get;set;}
 

  public UnderGradute__c ugform{
    get {
      if (ugform== null)
       ugform = new UnderGradute__c();
       
      return ugform;
    }
    set;
  }
  
  
  
    public PageReference Ugpage4() {
        return page.UG_page4;
    }
    
    
    public PageReference ugpage3() {
        return page.UG_page3;
    }
    
    
    public PageReference ugpage2() {
        return page.UG_page2;
    }


    public PageReference ugpage1() {
        return page.UG_Page1;
    }



    
     public Ugcontroller () {
    
      
  }
  
  
    public class Sampledate {
            
            public Sampledate() {
        
            }
       }
    
public List<SelectOption> getyearOptions() {
        List<SelectOption> countryOptions = new List<SelectOption>();
        countryOptions.add(new SelectOption('','-None-'));
        
        for(integer i=2016;i<=2022;i++)
        {
        string s = string.valueof(i);
        countryOptions.add(new SelectOption(s,s));
        }
        
        return countryOptions;
    } 

    public PageReference cancel() {
        return null;
    }

    public PageReference save() {
    system.debug(this.ugform);
    
           try {
      ugform.Year_Enrollment__c = String.valueOf(selectedyear);
      ugform.Date_of_Birth_ug__c = Date.valueof(dat);
      upsert ugform;
     
    } catch (DMLException e) {
      ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR,'Error creating new Undergraduate.'));
      return null;
    }
     Pagereference ref = new Pagereference('/apex/UG_congrats?id=' +ugform.id);

              ref.setRedirect(true);
            
         // if successfully inserted new lform, then displays the thank you page.
           return ref;
        
    }
            public PageReference getpdfpage() {
  this.ugId = ApexPages.currentPage().getParameters().get('id');
  Pagereference ref = new Pagereference('/apex/UG_PDF_Page?id=' +this.ugId);

              ref.setRedirect(true);
            
         // if successfully inserted new lform, then displays the thank you page.
           return ref;      
    }
    
    public with sharing class ExamplePageController {

    public ExamplePageController(Ugcontroller controller) {

    }

  public UnderGradute__c ugform{get; set;}
  public String StringDate {get; set;}
  public String StringDateDOW {get; set;}
  public String BirthdateDOW {get; set;}
  
  // create a temporary contact 
  public ExamplePageController() {
   
    ugform = new UnderGradute__c();
  }
  
  // find the day of the week for Birthdate.  Date.valueOf can be used with Date fields
  public PageReference FindBirthdateDOW() {
    try {
      BirthdateDOW = DateTime.newInstance( Date.valueOf(ugform.Date_of_Birth_ug__c), Time.newInstance(0, 0, 0, 0) ).format('EEEE');
    } catch (exception e) {
      BirthdateDOW = '';
    } 
    return null;
  }
  
}

}
Hi everyone,
Can anyone hlep me how to write the test class for the after insert trigger. I'm new to salesforce.
My trigger is as below
trigger ChangeLeadStatus on Task (after update) {
    Set<Id> leadIds = new Set<Id>();
    for(Task tsk : trigger.new){
        if(tsk.Status == 'Completed' && String.valueOf(tsk.whoId).startsWith('00Q')){
            leadIds.add(tsk.whoId);
        }
    }
    Map<Id,Lead> allRealtedLeads = new Map<Id,Lead>([Select status from Lead where ID IN :leadIds]);
    List<Lead> leadsToUpdate = new List<Lead>();
    for(Task tsk : trigger.new){
        if(tsk.Status == 'Completed' && String.valueOf(tsk.whoId).startsWith('00Q') && allRealtedLeads.containsKey(tsk.whoId)){
            allRealtedLeads.get(tsk.whoId).Status = tsk.Subject;
            leadsToUpdate.add(allRealtedLeads.get(tsk.whoId));
        }
    }
    if(leadsToUpdate.size() > 0){
        update leadsToUpdate;
    }
}

regards,
Suneel.
Hi all,
I want to write teh test class for the trigger below. It's new to write the test class for trigger.
trigger changeowner on Lead (before insert) {
     Map<String,Id> zipCodeUserMap = new Map<String,Id>();
     
      for(Zip_Code__c custom : [Select id,ZipCode__c, Counserlor__c  from Zip_Code__c ]) {
        zipCodeUserMap.put(custom.ZipCode__c,custom.Counserlor__c  );    
    }
       for(Lead l : Trigger.new) {
        if(zipCodeUserMap.containsKey(l.Zip_Code__c)) {
            l.Ownerid = zipCodeUserMap.get(l.Zip_Code__c);
        }
     }
}

Regards,
Suneel.
Hi all,
I want to validate the custom check box before submitting Force.com sites custom vfpage. Can we use standard validation over here...? because i want to make the check box as mandetory. how can we achive this. Can anyone help me over here.

Thanks in advance.
regards,
Suneel.
Hi all,
I want to download the PDF in the new tab when a button in custom vfpage is clicked. Can anyone help me over here.
Hi all,
Can anyone help me in writting test class for this.

public class Ugcontroller {

    public String getBirthdateDOW() {
        return null;
    }


    public PageReference FindBirthdateDOW() {
        return null;
    }


 public String selectedyear{get;set;}
 public Date dat{get;set;}
 public ID ugId{get;set;}
 

  public UnderGradute__c ugform{
    get {
      if (ugform== null)
       ugform = new UnderGradute__c();
       
      return ugform;
    }
    set;
  }
  
  
  
    public PageReference Ugpage4() {
        return page.UG_page4;
    }
    
    
    public PageReference ugpage3() {
        return page.UG_page3;
    }
    
    
    public PageReference ugpage2() {
        return page.UG_page2;
    }


    public PageReference ugpage1() {
        return page.UG_Page1;
    }



    
     public Ugcontroller () {
    
      
  }
  
  
    public class Sampledate {
            
            public Sampledate() {
        
            }
       }
    
public List<SelectOption> getyearOptions() {
        List<SelectOption> countryOptions = new List<SelectOption>();
        countryOptions.add(new SelectOption('','-None-'));
        
        for(integer i=2016;i<=2022;i++)
        {
        string s = string.valueof(i);
        countryOptions.add(new SelectOption(s,s));
        }
        
        return countryOptions;
    } 

    public PageReference cancel() {
        return null;
    }

    public PageReference save() {
    system.debug(this.ugform);
    
           try {
      ugform.Year_Enrollment__c = String.valueOf(selectedyear);
      ugform.Date_of_Birth_ug__c = Date.valueof(dat);
      upsert ugform;
     
    } catch (DMLException e) {
      ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR,'Error creating new Undergraduate.'));
      return null;
    }
     Pagereference ref = new Pagereference('/apex/UG_congrats?id=' +ugform.id);

              ref.setRedirect(true);
            
         // if successfully inserted new lform, then displays the thank you page.
           return ref;
        
    }
            public PageReference getpdfpage() {
  this.ugId = ApexPages.currentPage().getParameters().get('id');
  Pagereference ref = new Pagereference('/apex/UG_PDF_Page?id=' +this.ugId);

              ref.setRedirect(true);
            
         // if successfully inserted new lform, then displays the thank you page.
           return ref;      
    }
    
    public with sharing class ExamplePageController {

    public ExamplePageController(Ugcontroller controller) {

    }

  public UnderGradute__c ugform{get; set;}
  public String StringDate {get; set;}
  public String StringDateDOW {get; set;}
  public String BirthdateDOW {get; set;}
  
  // create a temporary contact 
  public ExamplePageController() {
   
    ugform = new UnderGradute__c();
  }
  
  // find the day of the week for Birthdate.  Date.valueOf can be used with Date fields
  public PageReference FindBirthdateDOW() {
    try {
      BirthdateDOW = DateTime.newInstance( Date.valueOf(ugform.Date_of_Birth_ug__c), Time.newInstance(0, 0, 0, 0) ).format('EEEE');
    } catch (exception e) {
      BirthdateDOW = '';
    } 
    return null;
  }
  
}

}
Hi everyone,
Can anyone hlep me how to write the test class for the after insert trigger. I'm new to salesforce.
My trigger is as below
trigger ChangeLeadStatus on Task (after update) {
    Set<Id> leadIds = new Set<Id>();
    for(Task tsk : trigger.new){
        if(tsk.Status == 'Completed' && String.valueOf(tsk.whoId).startsWith('00Q')){
            leadIds.add(tsk.whoId);
        }
    }
    Map<Id,Lead> allRealtedLeads = new Map<Id,Lead>([Select status from Lead where ID IN :leadIds]);
    List<Lead> leadsToUpdate = new List<Lead>();
    for(Task tsk : trigger.new){
        if(tsk.Status == 'Completed' && String.valueOf(tsk.whoId).startsWith('00Q') && allRealtedLeads.containsKey(tsk.whoId)){
            allRealtedLeads.get(tsk.whoId).Status = tsk.Subject;
            leadsToUpdate.add(allRealtedLeads.get(tsk.whoId));
        }
    }
    if(leadsToUpdate.size() > 0){
        update leadsToUpdate;
    }
}

regards,
Suneel.