• Bhargav krishna 1
  • NEWBIE
  • 10 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 10
    Questions
  • 7
    Replies
Hi all,
Can anyone help me how to write the test class for the below trigger.
trigger CousnselorNotification on Inquiry_Form_Leads__c (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(Inquiry_Form_Leads__c l : Trigger.new) {
        if(zipCodeUserMap.containsKey(l.Zip_Code__c)) {
            l.Ownerid = zipCodeUserMap.get(l.Zip_Code__c);
        }
     }
     
    Map<String,String> mapZipForEmail = new Map<String,String>();
    //Postal code from Lead object and Zip code from Zip_code__c
    for(Zip_Code__c thisZipCode : [Select id,ZipCode__c,Counserlor__c from Zip_Code__c ]){
        mapZipForEmail.put(thisZipCode.ZipCode__c, thisZipCode.Counserlor__c);
    }
 
    //EmailTemplate templateId = [Select id from EmailTemplate where name ='New Student Alert'];
  //  Create a master list to hold the emails
  List<Messaging.SingleEmailMessage> mails =  new List<Messaging.SingleEmailMessage>();
  
  for (Inquiry_Form_Leads__c myLead : Trigger.new) {
    if(mapZipForEmail.containsKey(myLead.Zip_Code__c)){
      
          Messaging.SingleEmailMessage mail =  new Messaging.SingleEmailMessage();
          
      //  list of people who should get the email
          List<String> sendTo = new List<String>();
          
          sendTo.add(mapZipForEmail.get(myLead.Zip_Code__c));
          mail.setToAddresses(sendTo);
        
          // Set email is sent from
          mail.setReplyTo('thredz@gmaiul.com');
          mail.setSenderDisplayName('Test');
          mail.setSaveAsActivity(false);
        
          mail.setTargetObjectId(UserInfo.getUserId());
          //mail.setTargetObjectId(Zip_Code__c.getUserId());
          // Set email contents
          //mail.setTemplateID(templateId.Id);//This is the template you are setting
        
          // Set email contents
         mail.setSubject('New Student');
          String body = 'Dear Counselor  ' + + ', ';
          body +='You Have a New Student.'+ myLead.Name+',';
          body +='Student Email.'+myLead.Email__c+',';
          body +='Student Mobile.' + myLead.Cell_Phone_Number__c;
          mail.setHtmlBody(body);
        
          // Add your email to the master list
          mails.add(mail);
      }
    
  }
  // Send all emails in the master list
  if(mails.size()>0)    Messaging.sendEmail(mails);
}

 
Hi everyone,
How to create a custom vfpage as PDF page. I have the component reanderedAS="PDF", but i was to see the field values in the genenrated PDF. Can anyone help me over here.

Regards,
Bhargav.
Hi everyone,
I'm unable to display the field values in the custom pdf page. Can anyone help me over here.

Thanks in advance,
Bhargav.
Hi all,
I want to change the font size in my custom vfpage inside the pageblocksection.
<apex:pageblocksection>
    <apex:inputField value="{!uform.Person_Name__c}"/>
</apex:pageblocksection>
I tried with style="width: 50%; height: 21px; font-size: 16px;" but it's not working.
Can anyone help me here.


Thanks in advance.
Regrads,
Bhargav.
Hi everyone,
I want to assign the Lead to the Sales Rep based on the Zipcode.I have more than 40,000 Zipcode and 5-10 sales Rep.
Can anyone help over here.

Regards,
Krishna.
Hi every one,
I want to create a button which dynamically add the fields up to 10 levels. Below is the screen shot of the group of fields which i want to add them dynamically when an Add button is clicked.
User-added image
Can any one help me over here.
 
Regards,
Bhargav.
Hi every one,
I'm displaying/hiding the fields based on the picklist values. In edit page when i change the picklist value the data in the previous fields is not updating. can anyone help me over here.

Thanks in advance,
regards,
Bhargav.

Hi everyone,
I have created a custom objectand in that i have a picklist field when ever we choose the value in that i want to show Date field and another picklist field. But by default these two fields must be hidden. Can help me over here.
Thanks In advance.
Regards,
Bhargav.
Hi everyone,
Can we Hide and Display the Custom fields in the Custom Object when a particular value in the picklist is selected.
Thanks in advance.
Regards,
Bhargav.
Hi everyone,
I want to display the Gender selection with radio buttons as shown in below image in Custom object
User-added image
Can anyone help me over here.
Thanks in advance.
Regards,
Bhargav.
Hi all,
I want to change the owner of the record when a field value is equal to the value of the another field in another object.
example:In lead object, custom field value is equal to the value of my custom object field then i want to change the owner of the lead as my custom object assigned user.
Can anyone help me over here.

Regards,
james
Hi every one,
I'm displaying/hiding the fields based on the picklist values. In edit page when i change the picklist value the data in the previous fields is not updating. can anyone help me over here.

Thanks in advance,
regards,
Bhargav.
Hi everyone,
I want to setup the Customer Portal user authentication using Force.com sites.  I have followed the instruction as below link
https://developer.salesforce.com/page/Authenticating_Users_on_Force.com_Sites
but  i'm unable to login, getting error as below.
User-added image

Can anyone help me over here.

Thanks in advance,
Regards,
raju.

Hi everyone,
I have created a custom objectand in that i have a picklist field when ever we choose the value in that i want to show Date field and another picklist field. But by default these two fields must be hidden. Can help me over here.
Thanks In advance.
Regards,
Bhargav.
Hi everyone,
Can we Hide and Display the Custom fields in the Custom Object when a particular value in the picklist is selected.
Thanks in advance.
Regards,
Bhargav.