• Akshara
  • NEWBIE
  • 30 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 5
    Replies
Hi All,

Use case analysis:-

We have a requirement to develop a mobile app which can be deployed on Android and iOS.
  • The app must be accessible to any user(not just salesforce user) who uses Android or iOS smartphone.
  • The app needs a login and signup with basic details.
  • The user should be able to see any Salesforce campaign details and any user who is willing to participate in the campaign should be able to signup(express interest) for the campaign.The user details and it's associated campaign details need to be stored in Salesforce
  • The user should also be able to track all their campaigns using the app

We are planning to implement this use case using Salesforce Mobile SDK but do not have any prior experience with mobile SDK.We want to know if this is feasible to implement with salesforce mobile SDK.If yes, what all resources do we need in order to implement this.Any help is much appreciated.Thanks in advance
Hello All,

Below apex class sends email to the specific contacts on a monthly basis.I want to know if there is any email bounce due to incorrect email.I have updated the settings in Email Deliverability to return the bounced emails to sender.However it is not working i.e., I don't get any email if I provide invalid email.Is there any way to know for which contacts the email is not delivered.I don't want to use email logs as the requirement is to update a date field on contact whenever email is delivered successfully.

Global class SendEmailToAccount implements Schedulable
{

   global void execute(SchedulableContext sc)
    {
                sendmail();
    }
 
    public void sendmail()
    {// Get default sender email address   
        OrgWideEmailAddress owa = [select id, DisplayName, Address from OrgWideEmailAddress where DisplayName='Sender' limit 1];
      //Get Email Template
        EmailTemplate templateId = [Select id from EmailTemplate where name = 'TemplateName'];
        
       List<Messaging.SingleEmailMessage> allmsg = new List<Messaging.SingleEmailMessage>();
       Set<Id> cid= new Set<id>();
       List<Account> accList = [select Id,primary_contact__c from Account where RecordType.developerName = 'My_Account_Record_Type'];
       List<Messaging.SendEmailResult> results;
       
       for(account acc:accList)
       {
            Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
            mail.setTemplateID(templateId.Id); 
            mail.setSaveAsActivity(false);    
            mail.setTargetObjectId(acc.Primary_Contact__c);
            mail.setWhatId(acc.Id);
            mail.setOrgWideEmailAddressId(owa.id);
            allmsg.add(mail);
            
       }
     
        if(allmsg.size()>0)
        {
              
              results =  Messaging.sendEmail(allmsg,false);
         }
        if (!results.get(0).isSuccess()) 
        {
            
            System.StatusCode statusCode = results.get(0).getErrors()[0].getStatusCode();
            String errorMessage = results.get(0).getErrors()[0].getMessage();
            system.debug(errorMessage);
        }
     }                                     
}
Can we use formulas in email templates such as TODAY()? I tried but it did not work.Any workarounds other than creating a formula fields and merging them?
Hello All,

Can someone help me write a test class for the below code.

Global class SendEmailToAccount implements Schedulable
{

   global void execute(SchedulableContext sc)
    {
                sendmail();
    }
 
    public void sendmail()
    {// Get default sender email address   
        OrgWideEmailAddress owa = [select id, DisplayName, Address from OrgWideEmailAddress where DisplayName='Sender' limit 1];
      //Get Email Template
        EmailTemplate templateId = [Select id from EmailTemplate where name = 'TemplateName'];
        
       List<Messaging.SingleEmailMessage> allmsg = new List<Messaging.SingleEmailMessage>();
       Set<Id> cid= new Set<id>();
       List<Account> accList = [select Id,primary_contact__c from Account where RecordType.developerName = 'My_Account_Record_Type'];
       List<Messaging.SendEmailResult> results;
       
       for(account acc:accList)
       {
            Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
            mail.setTemplateID(templateId.Id); 
            mail.setSaveAsActivity(false);    
            mail.setTargetObjectId(acc.Primary_Contact__c);
            mail.setWhatId(acc.Id);
            mail.setOrgWideEmailAddressId(owa.id);
            allmsg.add(mail);
            
       }
     
        if(allmsg.size()>0)
        {
              
              results =  Messaging.sendEmail(allmsg,false);
         }
        if (!results.get(0).isSuccess()) 
        {
            
            System.StatusCode statusCode = results.get(0).getErrors()[0].getStatusCode();
            String errorMessage = results.get(0).getErrors()[0].getMessage();
            system.debug(errorMessage);
        }
     }                                     
}
Hello All,

Which Data type is better to use for Formula field which returns Phone Number? 

Text or Number? Is there any way that we can display formula field phone number in salesforce phone number format? ex:(123)-456-7890
 
Hi all,

My requirement is to send an email to all the Active accounts on the 1st of every month.I have to use apex Scheduler since it is not possible to do with a workflow.

I started with the below skeleton code and I want to test this using execute anonymous window.

Global class SendEmailAccount implements Schedulable
{
       global void execute(SchedulableContext sc)
                        {
                                    sendmail();
                        }
 
                        public void sendmail()
                        {// Get default sender email address   
                            OrgWideEmailAddress owa = [select id, DisplayName, Address from OrgWideEmailAddress limit 1];
                            EmailTemplate templateId = [Select id from EmailTemplate where name = 'TemplateName’];
                            List<Messaging.SingleEmailMessage> allmsg = new List<Messaging.SingleEmailMessage>();
                            Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
                            mail.setTemplateID(templateId.Id); 
                            mail.setToAddresses(new String[] { ‘Senderemailaddress’});
                            mail.setSaveAsActivity(false);
                            mail.setOrgWideEmailAddressId(owa.id);
                            allmsg.add(mail);
                            System.debug('inside sendmail method');
                            if(allmsg.size()>0)
                            {
                             Messaging.sendEmail(allmsg,false);
                              System.debug('inside send mesage method');
                            }
                            
                        }
                                               
}


I used below code in anonymous window

SendEmailAccount  SEA= new SendEmailAccount();
                SEA.execute(null);
The code is getting executed but I don't see any email.Any help would be appreciated.Also, can someone let me know how to dynamically insert sender's email address with account email address?
Hello All,

Can someone help me write a test class for the below code.

Global class SendEmailToAccount implements Schedulable
{

   global void execute(SchedulableContext sc)
    {
                sendmail();
    }
 
    public void sendmail()
    {// Get default sender email address   
        OrgWideEmailAddress owa = [select id, DisplayName, Address from OrgWideEmailAddress where DisplayName='Sender' limit 1];
      //Get Email Template
        EmailTemplate templateId = [Select id from EmailTemplate where name = 'TemplateName'];
        
       List<Messaging.SingleEmailMessage> allmsg = new List<Messaging.SingleEmailMessage>();
       Set<Id> cid= new Set<id>();
       List<Account> accList = [select Id,primary_contact__c from Account where RecordType.developerName = 'My_Account_Record_Type'];
       List<Messaging.SendEmailResult> results;
       
       for(account acc:accList)
       {
            Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
            mail.setTemplateID(templateId.Id); 
            mail.setSaveAsActivity(false);    
            mail.setTargetObjectId(acc.Primary_Contact__c);
            mail.setWhatId(acc.Id);
            mail.setOrgWideEmailAddressId(owa.id);
            allmsg.add(mail);
            
       }
     
        if(allmsg.size()>0)
        {
              
              results =  Messaging.sendEmail(allmsg,false);
         }
        if (!results.get(0).isSuccess()) 
        {
            
            System.StatusCode statusCode = results.get(0).getErrors()[0].getStatusCode();
            String errorMessage = results.get(0).getErrors()[0].getMessage();
            system.debug(errorMessage);
        }
     }                                     
}
Hello All,

Which Data type is better to use for Formula field which returns Phone Number? 

Text or Number? Is there any way that we can display formula field phone number in salesforce phone number format? ex:(123)-456-7890
 
Hi all,

My requirement is to send an email to all the Active accounts on the 1st of every month.I have to use apex Scheduler since it is not possible to do with a workflow.

I started with the below skeleton code and I want to test this using execute anonymous window.

Global class SendEmailAccount implements Schedulable
{
       global void execute(SchedulableContext sc)
                        {
                                    sendmail();
                        }
 
                        public void sendmail()
                        {// Get default sender email address   
                            OrgWideEmailAddress owa = [select id, DisplayName, Address from OrgWideEmailAddress limit 1];
                            EmailTemplate templateId = [Select id from EmailTemplate where name = 'TemplateName’];
                            List<Messaging.SingleEmailMessage> allmsg = new List<Messaging.SingleEmailMessage>();
                            Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
                            mail.setTemplateID(templateId.Id); 
                            mail.setToAddresses(new String[] { ‘Senderemailaddress’});
                            mail.setSaveAsActivity(false);
                            mail.setOrgWideEmailAddressId(owa.id);
                            allmsg.add(mail);
                            System.debug('inside sendmail method');
                            if(allmsg.size()>0)
                            {
                             Messaging.sendEmail(allmsg,false);
                              System.debug('inside send mesage method');
                            }
                            
                        }
                                               
}


I used below code in anonymous window

SendEmailAccount  SEA= new SendEmailAccount();
                SEA.execute(null);
The code is getting executed but I don't see any email.Any help would be appreciated.Also, can someone let me know how to dynamically insert sender's email address with account email address?