Salesforce

Salesforce

Automatic email scheduler to Contacts accosiated with those Opportunities

Batch Class: global class opptyDetails implements Database.Batchable<sobject>{    global Database.QueryLocator start(Database.BatchableContext bc)    {        String soql = 'SELECT Opportunity.Name, Opportunity.OrderNumber__c, Opportunity.Approval_Status__c, Contact.Email, Contact.Name, Contact.Level__c FROM OpportunityContactRole';        return Database.getQueryLocator(soql);    }        global void ....

Salesforce

How clone a record with related records in Salesforce?

Sample Code: Visualforce page: <apex:page controller="Sample" sidebar="false"> <apex:form > <apex:pageblock > <apex:pageblockSection > <apex:pageblockSectionItem >Enter the Account Id:</apex:pageblockSectionItem> <apex:pageblockSectionItem ><apex:inputtext value="{!idOfRec}" /></apex:pageblockSectionItem> </apex:pageblockSection> <apex:pageblockButtons > <apex:commandButton value="Clone" action="{!cloneRec}"/> </apex:pageblockButtons> </apex:pageblock> ....

Salesforce

IN operator in SOQL

Sample Code:     public List<String> ids = new List<String>                              {'003A0560014LLW9','a03A0000014LLWi','s03A000er14LLWq',                             'a03A034d014LLWi','a03un000014LLWi',                             'a03A0y00014LLW9','0019000000GuZEF'};        public List<Account> acc {get;set;}       public void find()    {               acc = Database.Query('Select Name, SLA__c From ....