Blogs

  • Using a ‘staging object’ for an outbound integration in Salesforce – Good or Bad?

    Question When implementing complex outbound integrations in Salesforce, one common approach is using staging objects to manage data flow between systems.  Now, question is do we need it always – is it good practice or bad. Recommendation We can SKIP using staging object if requirement is simple like “Fire and Forget” or just quick processing…

    Read more…

  • Send Email using Apex and save as Activity

    // Create an email message objectMessaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();String emailAddress = (String) obj.get(‘Email’);// String[] toAddresses = new String[] {obj.Email};String[] toAddresses = new String[] {emailAddress};/*mail.setToAddresses(toAddresses);mail.setSubject(subject);mail.setHtmlBody(body);mail.setWhatId(c.Id);*/mail.setTemplateId(templateId);mail.setTargetObjectId(obj.Id);

    Read more…

  • Understand the error – System.QueryException: List has no rows for assignment to SObject

    Description This issue you may encounter in apex class if you have query like this: The following query is not returning any number of records: Lead l = [SELECT Id FROM Lead WHERE Id = : recordId]; The error “List has no rows for assignment to SObject” occurs when query doesn’t return any rows. Possible Reason…

    Read more…