Salesforce

An effort to bring a revolution in Salesforce.

Saturday 18 November 2017

How to Auto Refresh a Salesforce Dashboard? Dashboard Auto-Refresh : Salesforce

Dashboard Auto-Refresh. Dashboard automatic refresh


You can setup chrome extension for Salesforce Dashboard Auto-Refresh. 

Click here... for chrome extension to Auto-Refresh Dashboard





, , , , ,

Thursday 26 October 2017

Future method cannot be called from a future or batch method: Error

CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY

System.AsyncException: Future method cannot be called from a future.

System.AsyncException: Future method cannot be called from a future or batch method


You need to check if the trigger is being fired from the future method, add the below line as your first line of trigger.

    if(system.isFuture() || System.isBatch()) return;

, , , ,

Thursday 6 April 2017

What is the formula to calculate the number of days between two dates?

Salesforce: Days between two dates

CreatedDate is not a Date datatype field it's a DateTime datatype, you need to convert it using a DATEVALUE function like this. 

Datatype = Formula
Result = Number 

TODAY () - DATEVALUE(CreatedDate) 

Error: Incorrect parameter for operator '-'. Expected Number, Date, received DateTime.


, ,

Thursday 23 February 2017

Status=Length Required, StatusCode=411 error in Apex callout

Status=Length Required  StatusCode=411


HttpRequest request = new HttpRequest();

request.setHeader('Content-Length', '512');
, , ,

Thursday 9 February 2017

Email To Opprtunity|Contact|Lead|Sobject Salesforce Email Service

Email To Opprtunity | Email To Sobject | Email To Contact | Salesforce Email  Service


global class EmailtoOpportunityCreation implements Messaging.InboundEmailHandler {

  global Messaging.InboundEmailResult handleInboundEmail(Messaging.InboundEmail email,
    Messaging.InboundEnvelope envelope) {

     Messaging.InboundEmailResult result = new Messaging.InboundEmailresult();
     System.debug('====> Created opportunity '+result);
     Contact vCon;
     for(Contact c: [Select Id, Name, Email, AccountId From Contact Where Email = :email.fromAddress Limit 1])
         vCon = c;
     if(vCon == null)
     {
        vCon = new Contact(lastname = 'Email-OPP',email = email.fromAddress);
        insert vCon;
        
        Account A = new Account(Name=email.Subject);
        vCon.AccountId = a.id;
        update vCon;
     }   
     
     Opportunity opportunity = new Opportunity();
     opportunity.Name = email.Subject;
     opportunity.StageName = 'Prospecting';
     opportunity.CloseDate = Date.today();
     opportunity.Email_Body__c = email.plainTextBody;
     //opportunity.Contact_Name__c = vCon.Id;
     opportunity.AccountId = vCon.AccountId;
     insert opportunity;
     
    
       System.debug('====> Created opportunity '+opportunity.Id);
       
      
if (email.binaryAttachments != null && email.binaryAttachments.size() > 0) {
      for (integer i = 0 ; i < email.binaryAttachments.size() ; i++) {
        Attachment attachment = new Attachment();
        // attach to the newly created opportunity record
        attachment.ParentId = opportunity.Id;
        attachment.Name = email.binaryAttachments[i].filename;
        attachment.Body = email.binaryAttachments[i].body;
        insert attachment;
      }
    }
  
    return result;

  }

}

Demo: Demo Link

, , ,

Get Gmail, Docs, Drive, and Calendar for business