• Manj_SFDC
  • SMARTIE
  • 905 Points
  • Member since 2014
  • Architect

  • Chatter
    Feed
  • 24
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 19
    Questions
  • 295
    Replies
Hello,

when the chat agent clicks on Request a file during a Salesforce Chat, he can choose a record to attach the file to, in my implementation it shows, Account, Contact and the case, do we have an option to hide these options and attach the file direclty to the case, please help, thanks!
I have created a related list for survey Invitation on the Account and it works as expected but If I open the same related list in customer community and navigate to the related list I can see the records but when I try to open the survey Inviation record, it throws an error,


Looks like there's a problem.
This record isn't supported. See your administrator for help.
Hi,

I have written an schedule class,in which when I run in production,it threw an error caused by: System.LimitException: Too many query rows: 50001

 line 25, column 1

 public void execute(SchedulableContext sc){
        
        list<lead> myFive9LeadList=[ select id,name,Originating_System__c,createdDate,Call_Center_Disposition_Date__c,Call_Center_Disposition_Details__c from lead where Originating_System__c='Five9' AND createdDate >:X15MinutesAgo];
        list<lead> mySparkroomLeadList=[ select id,name,Originating_System__c,createdDate from lead where Originating_System__c='Sparkroom' AND createdDate >:X15MinutesAgo];

//Line 25
        list<lead> myLeadListDispositions=[ select id,name,Originating_System__c,createdDate from lead where Call_Center_Disposition_Details__c='Transfer' AND Call_Center_Disposition_Date__c >:X15MinutesAgo];
        
        
        //For No Lead from Five9
        if(myFive9LeadList.size()==0 ){
            system.debug('Five9 List Size'+ myFive9LeadList.size());
            Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
            mail.setToAddresses(toAddresses );
            mail.setCcAddresses(ccAddresses);
            mail.setSubject('Notification:: No Lead from Five9');
            String messageBody = '<html><body>Hi, &nbsp;&nbsp;&nbsp;</body> <br/> Last 15 minutes no lead generated from Five9.<br/>Please look into Five9 lead process and make sure that it is working fine.<br/><br/>Thanks </html>


Thanks..





 
Hi, 
 I,m unable to get code coverage for sending emailnotification. can anyone help me. Thanks in advance

public class NotificationEmail {
    
     public static void sendNotificationEmail(List<Account> newList2){
          
        map<id,set<string>> AccRecp = new map<id,set<string>>();
       
         for(Account acc2 : newList2)
        {
            if(acc2.Activity_Email__c != null && acc2.Activity_Email__c != '' && acc2.Status__c == true )
            {
                set<string> emailids = new set<string>();
             
                list<string> templist = acc2.Activity_Email__c.split(',');
               
                emailids.addALL(templist);
              
                AccRecp.put(acc2.id,emailids);
               
            }
             
        }
         if(!AccRecp.isEmpty())
        {
            EmailTemplate et = [ Select Body, HtmlValue, Id, Name, Subject from EmailTemplate  where Name='Post Suspension' Limit 1];
            List<Messaging.SingleEmailMessage> theEmails = new list<Messaging.SingleEmailMessage>();
             for(Account ac: newList2)
            {
                if(AccRecp.containsKey(ac.id))
                {
                    set<string> temp = AccRecp.get(ac.Id);
                   
                    list<string> emaillist= new list<string>();
                     emaillist.add(label.Account_team);
                    emaillist.addAll(temp);
                    string body = et.Body;
                    
                    OrgWideEmailAddress[] ar = [select Id,Address from OrgWideEmailAddress where Address = 'abc@company.com' ];
                    Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
                    mail.setToAddresses(emaillist);
                    mail.setSubject(' Notice of Suspension-' +' '+ ac.Name);
                    mail.setOrgWideEmailAddressId(ar.get(0).id);
                    mail.setPlainTextBody(body);
                    theEmails.add(mail);
                    
                }
            }
        
              if(!theEmails.isEmpty())
            {
                list<Messaging.Email> allMails = new list<Messaging.Email>();
                for( Integer j = 0; j < theEmails.size(); j++ ){
                    allMails.add(theEmails.get(j));
                }
                if(!allMails.isempty())
                    
                {
                    Messaging.SendEmailResult[] results = Messaging.sendEmail( allMails,false );
                    
                    if (results[0].isSuccess()) {
                        
                        
                        system.debug('The email was sent successfully.');
                     } else {
                         system.debug('The email failed to send: '+results[0].getErrors());
                     }
                }
            }
        }
    }
I have wrapper class which I want to pass to batch class as want to send 1000's of email and also want to update records
Hi All,

I wanted to roll up the 2 text fields of a child object into parent object how to that 
Example :   Value 1 + '  ' +  Quality 1;
                   Value 2  + '  ' + Quality 2
                  Value  3 + '  ' +   Quality 3
I wnated to rollup this  vlaues to the parent obejct 
I'm trying to create an Apex Class that checks all Account records on a daily basis and sends an email to the email field on ones that have a review due on that date.

For example:
Vendor ABC Pty Ltd has opted in for reviews (Vendor Review: Reminders = true), has an annual review date set in their record (Vendor Review: Date = 17/02/2019), and an email address set in their record (Vendor Review: Email = abc@test.com).

Here is my code:
global class VendorReviewCronJob implements Schedulable{ 
    
        global void execute(SchedulableContext SC) {
            sendmail();
        }

        public List<Id> getVendorReviewEmailAddresses(Integer Month, Integer Day) 
        { 
            List<Id> mailToIds = new List<Id>();
             
            Account[] a = [SELECT Id, Vendor_Review_Email__c, Vendor_Review_Date__c, Vendor_Review_Reminders__c
                            FROM Account 
                            WHERE DAY_IN_MONTH(Vendor_Review_Date__c) = : Day 
                            AND CALENDAR_MONTH(Vendor_Review_Date__c) = : Month   
                            ];
        
            for(Account recipient : a) {
                    
                    System.Debug('\n*******Found VendorReview Recipient');
                                        
                    if (recipient.Vendor_Review_Reminders__c == true)
                    {
                        mailToIds.add(recipient.Id);
                        System.Debug('\n*******Recipient: '+ recipient.Vendor_Review_Email__c);
                         
                    } else {
                        System.Debug('\n*******NO Recipient');
                    }
                
            }

            return mailToIds;
        }




        public void sendMail() 
        {
      
            String debugAddress = 'eyewell@salesforce.com';
            String VendorReviewEmailTemplateName = 'User_Vendor_Review_Required';       
            String debugMessage;
            String[] toAddresses;

            Integer DayOfEvent   = date.today().day();
            Integer MonthOfEvent = date.today().month();

            List<Id> VendorReviewIdsList = getVendorReviewEmailAddresses(MonthOfEvent,DayOfEvent);

            EmailTemplate VendorReviewTemplate = [select Id,Name,Subject,body from EmailTemplate where DeveloperName = :VendorReviewEmailTemplateName];
 
            if(VendorReviewTemplate != null && VendorReviewIdsList.isEmpty() == false)
            {

                Messaging.MassEmailMessage VendorReviewMail = new Messaging.MassEmailMessage();
    
                VendorReviewMail.setTargetObjectIds(VendorReviewIdsList);
                VendorReviewMail.setTemplateId(VendorReviewTemplate.Id);
                VendorReviewMail.setUseSignature(false);
                VendorReviewMail.setSaveAsActivity(true);

                try {
                    Messaging.sendEmail(new Messaging.MassEmailMessage[] { VendorReviewMail });
                }catch(Exception e)
                {
                    System.Debug(e);
                }
           
            }
            else
            {
                System.Debug('VendorReviewCronJob:sendMail(): Either an email template could not be found, or no Account has a Vendor Review today');
            }

                
        }

    
}
I've scheduled the apex class to run daily, but although it's showing that it has run, the emails for the reviews due that day haven't sent, and I also haven't received the confirmation email of how many were sent.

Admittedly, I got the base of the code from a mailer that was checking for birthdays on a Contact object, but I felt the same principles still applied.

Can anybody see where I've gone wrong?
I am currently working as a SF tester but trying to move to SF development. I have attended few interviews, though theory part or direct questions are going well but every time I am getting stuck when the opposite party starts with the scenario based questions. As I have not worked as a developer so I lack that experience. Can anyone tell me or help me out, from where I can prepare myself or how can I make myself good in handling scenarios.

Anykind of suggestions will be appreciated. 

My apology if this not the correct platform to ask this question.
Can anyone tell me why we dont have before undelete trigger ?
Hello Everyone,

I am fairly new to Salesforce. I have encounter this issue and would like to see, is there anyone that can help me with this roadblock that I have encounter? Is there any documents, videos or anyone who can help me with pertaining to how to run a query to find email templates that contain a certain string ex: Pasta that would also include the subject line and content, and trigger if possible
Hi All,
         I have custom field in account object, I put an image in that custom field.I want to send an email along with account name and that custom field using email templates how it is possible ..... 
what type of custom field I have to create & how to send an email Can you please help me.............................................................
 
Suppose we have Status field in Account object with dropdown values as 
  • Open
  • Working
  • Close
My requirement is whenever I create a Account record bydefault Status should take value as Open And if Status is Open then three more fields in the same Account object should be updated with some particular values say 30, 45 and 69.

For the above mentioned scenario what shall I choose, Workflow or Process builder.
 
Heelo folks,

I have a custom object and Allow Reports is disabled on it, I would like to grant the permission to some of the users to create a report on that custom object , can it be done?

Thanks