• Prince Venkat
  • NEWBIE
  • 175 Points
  • Member since 2021

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 30
    Questions
  • 17
    Replies

how to reference contact field from Account object in apex class??


Any Help
Thanks in advance

Hi
Whenever we click on edit on contact phone it should be displayed in this specified format (xxx) xxx-xxxx

but i am getting like this how can we achieve this User-added image
Hi All

I Have Stored a Image in Static resource and by using
<apex:image id="Logo5" value="{!$Resource.Logo5}" width="100%" />
I added in VF page

But the image should be displayed full , i marked with the yellow sketch those area also the image should occupy ,
How Can i achieve This ? , What changes should i make

Thanks In advance

User-added image

Number Type Formula Field

Criteria : (Create Date – Date of Birth)/365.2

Date of Birth is a field in the org

How to consider Create Date Here?

Thanks in advance

 

 

How to write a formula field fetching the first 3 digit of text field


Thanks in advance
How to add parameterized method in testclass.
My sample class
public class Training{
public static void work (Account accRec){
----------
-------
}

how to write test class for this

@isTest
private class testClass
{
testmethod static void myTest ()
{
test.starttest();
Training.work ();
test.stoptest();
}
}

getting error

Any Assistance



 
Create trigger handler on System

new record created When status includes mandatory  email

map contact__r.email primary email

Record is deleted when status includes mandatory Email

contact__r.email removed from primary email
 
Hi
How to decrease the Actual  width of  Candidate Position,Candidate Location , Address Type,  More width of Available, Flexible should be displayed

Thanks in advance


<div class='slds-grid slds-wrap' >
                            <div class="slds-truncate slds-box slds-box_x-small slds-text-align_center slds-m-around_x-small" style="text-align:center" title="Candidate Position">View Record</div>
                          
                      <th class="slds-size_1-of-10" scope="col">
                            <div class="slds-truncate slds-box slds-box_x-small slds-text-align_center slds-m-around_x-small" style="text-align:center" title="Candiadate Location">Name</div>
                      </th>
                     
                      <th class="slds-size_1-of-10" scope="col">
                            <div class="slds-truncate slds-box slds-box_x-small slds-text-align_center slds-m-around_x-small" style="text-align:center" title="Address Type">Address Type</div>
                          
                      </th>
                      
                      <th class="slds-size_1-of-10" scope="col">
                            <div class="slds-truncate slds-box slds-box_x-small slds-text-align_center slds-m-around_x-small" style="text-align:center" title="Location">Location</div>
                         
                      </th>
                      
                      <th class="slds-size_1-of-10" scope="col">
                            <div class="slds-truncate slds-box slds-box_x-small slds-text-align_center slds-m-around_x-small" style="text-align:center" title="Phone">Phone</div>
                          
                      </th>
                      <th class="slds-size_1-of-10" scope="col">
                            <div class="slds-truncate slds-box slds-box_x-small slds-text-align_center slds-m-around_x-small" style="text-align:center" title="Email">Email</div>
                          
                      </th>
                      <th class="slds-size_1-of-10" scope="col">
                            <div class="slds-truncate slds-box slds-box_x-small slds-text-align_center slds-m-around_x-small" style="text-align:center" title="Fax">Fax</div>
                      </th>
                      <th class="slds-size_1-of-10" scope="col">
                            <div class="slds-truncate slds-box slds-box_x-small slds-text-align_center slds-m-around_x-small" style="text-align:center; width: 150px; " title="Available">Available</div>
                          
                      </th>
                      
                      <th class="slds-size_1-of-10" scope="col">
                            <div class="slds-truncate slds-box slds-box_x-small slds-text-align_center slds-m-around_x-small" style="text-align:center; width: 150px; " title="Flexible ">Flexible</div>
                          
                      </th>
                      
                     <th class="slds-size_1-of-10" scope="col">
                            <div class="slds-truncate slds-box slds-box_x-small slds-text-align_center slds-m-around_x-small" style="text-align:center" title="Exceed Limit">Exceed Limit</div>
                          
                      </th>

</div>
Hi,
I have total ten fields which are displayed on the page.The page is designed using lwc .

Now the width between two particular fields should be increased and also the ten fields should be displayed. How to achieve

The displayed are displayed by

<th class="slds-size_1-of-10" scope="col">
                          <div class="slds-truncate" style="text-align:center" title="Finish Role">Role</div>
                          <!-- <div class="slds-truncate" style="text-align:center" title="Finish Role">Role</div> -->
                      </th>

<th class="slds-size_1-of-10" scope="col">
                          <div class="slds-truncate" style="text-align:center" title="start Role"> Role</div>
                          <!-- <div class="slds-truncate" style="text-align:center" title="start Role">Role</div> -->
                      </th>


Any Assistance

Thanks in advance


 
Whenever Lead Record is Created and it is converted into opportunity. and then it should immediately change from lead page (00Q) to opportunity page URL (006) (Redirect from lead page to opportunity)

Below is my code.

Any assistance

public class LeadTriggerHandler
{
    Public static void AfterUpdate(List<Lead> lstLeads)
    {
        LeadStatus lStatus = [Select id, MasterLabel, isConverted
                                                 from LeadStatus
                                                     Where isConverted = true];
        
        List<Database.LeadConvert> leadsToConvert = new List<Database.LeadConvert>();
        
        for(Lead ldRecord : lstLeads)
        {
            if(ldRecord.Status == 'Closed - Converted' && ldRecord.IsConverted == false)
            {
                Database.LeadConvert lConvert = new Database.LeadConvert();
                
                    lConvert.setLeadId(ldRecord.Id);
                    lConvert.setSendNotificationEmail(true);
                    lConvert.setDoNotCreateOpportunity(false);
                    lConvert.setConvertedStatus(lStatus.MasterLabel);
                  // Add the record to the Collection..
                leadsToConvert.Add(lConvert);
            }
        }
        
        if(! leadsToConvert.isEmpty())
        {
            Database.LeadConvertResult[] results =    Database.convertLead(leadsToConvert);
        }
    }
}


Thank you
 
Hi

Whenever Lead Record is Created and it is converted into opportunity. and then it should immediately change from lead page (00Q) to opportunity page URL (006) (Redirect from lead page to opportunity)

Below is my code.

Any assistance

public class LeadTriggerHandler
{
    Public static void AfterUpdate(List<Lead> lstLeads)
    {
        LeadStatus lStatus = [Select id, MasterLabel, isConverted
                                                 from LeadStatus
                                                     Where isConverted = true];
        
        List<Database.LeadConvert> leadsToConvert = new List<Database.LeadConvert>();
        
        for(Lead ldRecord : lstLeads)
        {
            if(ldRecord.Status == 'Closed - Converted' && ldRecord.IsConverted == false)
            {
                Database.LeadConvert lConvert = new Database.LeadConvert();
                
                    lConvert.setLeadId(ldRecord.Id);
                    lConvert.setSendNotificationEmail(true);
                    lConvert.setDoNotCreateOpportunity(false);
                    lConvert.setConvertedStatus(lStatus.MasterLabel);
                  // Add the record to the Collection..
                leadsToConvert.Add(lConvert);
            }
        }
        
        if(! leadsToConvert.isEmpty())
        {
            Database.LeadConvertResult[] results =    Database.convertLead(leadsToConvert);
        }
    }
}


Thank you
 
Hi

when ever lead record type called convert is selected it should convert into opportunity record type called general .

How to achieve this

Any assistance

Thank you
When ever a lead record is inserted automatically convert into account,contact,opportunity .Need to convert with a help of trigger.

Any Assistance

Thanks
Hi

when ever we send an email it should be logged with an object activity.

How to achieve this

Thanks in advance
Hi
Below is my code can anyone help with a testclass for it for max code coverage.

public class LeadEmail
{
public static void SendEmailTolead(list<lead> lstLead)
{
    if(! lstLead.isEmpty())
   {
        list<messaging.SingleEmailMessage> lstEmails = new list<messaging.SingleEmailMessage>();
    for(lead lr : lstLead)
    {
        messaging.SingleEmailMessage email = new messaging.SingleEmailMessage();
        string[] toEmailsIds = new string[]{lr.Email};
        email.settoAddresses(toEmailsIds);
        
        email.setTargetObjectId( UserInfo.getUserId() );
        
        email.setSaveAsActivity( false );

        email.setSenderDisplayName('lead Record Creation Alert');
        
        email.setReplyTo('support@RFI.com');
        
        string emailsubject = 'congralutions'+lr.Name+'you have been registerd';
        
        email.setSubject(emailsubject);
        
        string emailHTMLContent = 'Dear'+lr.name+',<br/> <br/>'+
               '<br/><br/> here are your details... <br/><br/>'+
            
                '<br/> Your Company....'+lr.Company+
                '<br/> Your tile for the Role'+lr.Title+
                '<br/> your Status for The record'+lr.Status+
            'thanks & Regards';
        
        email.setHtmlBody(emailHTMLContent);
        
        lstEmails.add(email);
        
    }
   if(!lstEmails.isempty())
    {
        Messaging.sendEmail(lstEmails);    }
    
    }
}
}
Thanks in advance
HI 
Below is my code.
 
public class LeadEmail
{
public static void SendEmailTolead(list<lead> lstLead)
{
    if(! lstLead.isEmpty())
   {
        list<messaging.SingleEmailMessage> lstEmails = new list<messaging.SingleEmailMessage>();
    for(lead lr : lstLead)
    {
        messaging.SingleEmailMessage email = new messaging.SingleEmailMessage();
        string[] toEmailsIds = new string[]{lr.Email};
            email.settoAddresses(toEmailsIds);
        
        
        email.setSenderDisplayName('lead Record Creation Alert');
        
        email.setReplyTo('support@RFI.com');
        
        string emailsubject = 'congralutions'+lr.Name+'you have been registerd';
        
        email.setSubject(emailsubject);
        
        string emailHTMLContent = 'Dear'+lr.name+',<br/> <br/>'+
               '<br/><br/> here are your details... <br/><br/>'+
            
                '<br/> Your Company....'+lr.Company+
                '<br/> Your tile for the Role'+lr.Title+
                '<br/> your Status for The record'+lr.Status+
            'thanks & Regards';
        
        email.setHtmlBody(emailHTMLContent);
        
        lstEmails.add(email);
        
    }
   if(!lstEmails.isempty())
    {
        Messaging.sendEmail(lstEmails);    }
    
    } 
}
}

Execute window

list<lead> lstLead = [select id,name,email,company,title,status from lead];
LeadEmail.SendEmailTolead(lstLead);



Getting error 
Line: 38, Column: 1
System.EmailException: SendEmail failed. First exception on row 5; first error: SINGLE_EMAIL_LIMIT_EXCEEDED, Email limit exceeded: []

Any assistance

​​​​​​​Thanks in advance
Hi
when ever picklist value changes in contact whenever leadsource changes to web batch apex should send an email
whenever leadsource changes to Phone Inquiry another email should send based on the email filed of the records
(Should be done through batch apex As it is be scheduled)

Thanks in advance
 
Hi

Below is my code.Send mails to mailid field of contact object to three members at a time. Getting an error. System.EmailException: SendEmail failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Add a recipient to send an email.: []

global class EmailToContactBatch implements Database.Batchable<sObject> 
{
    global database.querylocator start(Database.BatchableContext BC) 
    {
        return Database.getQueryLocator([select id,name,Email from Contact order by Email asc limit 3]);
    }
   
    global void execute(Database.BatchableContext BC, Sobject[] scope) 
    {
        List<Messaging.SingleEmailMessage> lstEmails = new List<Messaging.SingleEmailMessage>();
        for(Contact objContact :(List<contact>) scope) 
        {
            Messaging.SingleEmailMessage objEmail = new Messaging.SingleEmailMessage();
            //Prepare SendToEmail List          
            List<String> lstSendToEmails = new List<String>();
            if(objContact.Email != null) 
            {
                lstSendToEmails.add(objContact.Email);
            }
            objEmail.setToAddresses(lstSendToEmails);
            //Prepare CCEmailList
            List<String> lstCCToEmails = new List<String>();
            if(objContact.Email != null) 
            {
                lstCCToEmails.add(objContact.Email);
            }
            objEmail.setCcAddresses(lstCCToEmails);
            
            //Set Email Subject
            objEmail.setSubject('Testing Emails');
           
           //Set Email Body
            String body = 'Dear Contact,please ready to contact if you have any issues';
            objEmail.setHtmlBody(body);
            lstEmails.add(objEmail);
            
        Messaging.sendEmail(lstEmails);
        }
    }

    global void finish(Database.BatchableContext BC) 
    {
        
    }
}

Thanks In advance
 
Hi

Do not allow if the Student(object Name) is trying to update the Participated checkbox to 'true' after the activity end date.

For example :- if activity end date is 4th may 2020 then do not allow user to update the Participated checkbox field to true on 5th may 2020

Hi
I have object called Student Activities with field check box
whenever it is true it should update in another object field called Enrollment Limit (object name -Activity Master)

whenever checkbox is true value enrollment limit value should increase
whenever checkbox is false value enrollment limit value should decrease
(Through coding should be done)

Thanks in advance

how to reference contact field from Account object in apex class??


Any Help
Thanks in advance

Hi
Whenever we click on edit on contact phone it should be displayed in this specified format (xxx) xxx-xxxx

but i am getting like this how can we achieve this User-added image
Hi,
I have total ten fields which are displayed on the page.The page is designed using lwc .

Now the width between two particular fields should be increased and also the ten fields should be displayed. How to achieve

The displayed are displayed by

<th class="slds-size_1-of-10" scope="col">
                          <div class="slds-truncate" style="text-align:center" title="Finish Role">Role</div>
                          <!-- <div class="slds-truncate" style="text-align:center" title="Finish Role">Role</div> -->
                      </th>

<th class="slds-size_1-of-10" scope="col">
                          <div class="slds-truncate" style="text-align:center" title="start Role"> Role</div>
                          <!-- <div class="slds-truncate" style="text-align:center" title="start Role">Role</div> -->
                      </th>


Any Assistance

Thanks in advance


 
Hi

when ever lead record type called convert is selected it should convert into opportunity record type called general .

How to achieve this

Any assistance

Thank you
HI 
Below is my code.
 
public class LeadEmail
{
public static void SendEmailTolead(list<lead> lstLead)
{
    if(! lstLead.isEmpty())
   {
        list<messaging.SingleEmailMessage> lstEmails = new list<messaging.SingleEmailMessage>();
    for(lead lr : lstLead)
    {
        messaging.SingleEmailMessage email = new messaging.SingleEmailMessage();
        string[] toEmailsIds = new string[]{lr.Email};
            email.settoAddresses(toEmailsIds);
        
        
        email.setSenderDisplayName('lead Record Creation Alert');
        
        email.setReplyTo('support@RFI.com');
        
        string emailsubject = 'congralutions'+lr.Name+'you have been registerd';
        
        email.setSubject(emailsubject);
        
        string emailHTMLContent = 'Dear'+lr.name+',<br/> <br/>'+
               '<br/><br/> here are your details... <br/><br/>'+
            
                '<br/> Your Company....'+lr.Company+
                '<br/> Your tile for the Role'+lr.Title+
                '<br/> your Status for The record'+lr.Status+
            'thanks & Regards';
        
        email.setHtmlBody(emailHTMLContent);
        
        lstEmails.add(email);
        
    }
   if(!lstEmails.isempty())
    {
        Messaging.sendEmail(lstEmails);    }
    
    } 
}
}

Execute window

list<lead> lstLead = [select id,name,email,company,title,status from lead];
LeadEmail.SendEmailTolead(lstLead);



Getting error 
Line: 38, Column: 1
System.EmailException: SendEmail failed. First exception on row 5; first error: SINGLE_EMAIL_LIMIT_EXCEEDED, Email limit exceeded: []

Any assistance

​​​​​​​Thanks in advance
Hi

Below is my code.Send mails to mailid field of contact object to three members at a time. Getting an error. System.EmailException: SendEmail failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Add a recipient to send an email.: []

global class EmailToContactBatch implements Database.Batchable<sObject> 
{
    global database.querylocator start(Database.BatchableContext BC) 
    {
        return Database.getQueryLocator([select id,name,Email from Contact order by Email asc limit 3]);
    }
   
    global void execute(Database.BatchableContext BC, Sobject[] scope) 
    {
        List<Messaging.SingleEmailMessage> lstEmails = new List<Messaging.SingleEmailMessage>();
        for(Contact objContact :(List<contact>) scope) 
        {
            Messaging.SingleEmailMessage objEmail = new Messaging.SingleEmailMessage();
            //Prepare SendToEmail List          
            List<String> lstSendToEmails = new List<String>();
            if(objContact.Email != null) 
            {
                lstSendToEmails.add(objContact.Email);
            }
            objEmail.setToAddresses(lstSendToEmails);
            //Prepare CCEmailList
            List<String> lstCCToEmails = new List<String>();
            if(objContact.Email != null) 
            {
                lstCCToEmails.add(objContact.Email);
            }
            objEmail.setCcAddresses(lstCCToEmails);
            
            //Set Email Subject
            objEmail.setSubject('Testing Emails');
           
           //Set Email Body
            String body = 'Dear Contact,please ready to contact if you have any issues';
            objEmail.setHtmlBody(body);
            lstEmails.add(objEmail);
            
        Messaging.sendEmail(lstEmails);
        }
    }

    global void finish(Database.BatchableContext BC) 
    {
        
    }
}

Thanks In advance
 
Hi
They are two objects Activity Master
Student Activities
Through programming want to create rollupsummary ( not through configuration)
Activity Master has a field No of Students Enrolled (count of records need to dispalyed here)


trigger Rollupmaster on Student_Activities__c (after insert,after update,after delete)
{
set<id> lstSet = new set<id>();
    list<Activity_Master__c> lstAm = new list<Activity_Master__c>();
    
if((trigger.isinsert || trigger.isupdate)&& trigger.isafter)    
{
    for(Student_Activities__c c : trigger.new)
    {
        if(c.id!=null)
        {
          lstSet.add(c.id);  
        }
    }
if(trigger.isdelete)
{
  for(Student_Activities__c c : trigger.old)  
  {
      lstSet.add(c.id);
  }
    
}
for(Activity_Master__c a :[select id,No_of_Students_Enrolled__c,(select id from Student_Activities__r) from
                             Activity_Master__c where id =:lstSet])
{
  a.No_of_Students_Enrolled__c = a.Student_Activities__r.size();
    lstAm.add(a);
}


update lstAm;

}
}

Getting error in soql query Any suggestions.

 
Hi

Through batch apex updating records
What ever mail id field  present in lead object to those mail ids email should be sent through bacth apex how is it achieved

Thanks in advance

Regards
Prince
Hi

when ever a record inserted by batch apex mail should be send to the respective owner how to achieve this

Thanks in advance
Hi
I have a picklist field called Type whenever i select a field from type it should automatically display on the another field called Name 
How to achieve this
Thanks in advance
 
Hi
document obj contains a csv file
it should be read by batch apex and records shoud be inserted into an object