• karthikeya 2
  • NEWBIE
  • 40 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 48
    Questions
  • 19
    Replies
Hi All,

I need to send email when the filed is changed to the record owner with old values and new value in the template.
It should be a class with out using trigger.
Can any one provide with the code.

Thanks in advance.
hi all need help in solving the below error.

Error message: -
"com.oracle.bpel.client.BPELFault: faultName: {{http://schemas.oracle.com/bpel/extension}remoteFault}
messageType: {{http://schemas.oracle.com/bpel/extension}RuntimeFaultMessage}
parts: {{
summary=<summary>oracle.fabric.common.FabricInvocationException: Unable to access the following endpoint(s): https://login.salesforce.com/services/Soap/u/36.0</summary>
,detail=<detail>Unable to access the following endpoint(s): https://login.salesforce.com/services/Soap/u/36.0</detail>
,code=<code>null</code>}
"
will appreciateyour help..
Hi all can any 1 help on this, what is the error related and how to resolve.

Error message: -
"com.oracle.bpel.client.BPELFault: faultName: {{http://schemas.oracle.com/bpel/extension}remoteFault}
messageType: {{http://schemas.oracle.com/bpel/extension}RuntimeFaultMessage}
parts: {{
summary=<summary>oracle.fabric.common.FabricInvocationException: Unable to access the following endpoint(s): https://login.salesforce.com/services/Soap/u/36.0</summary>
,detail=<detail>Unable to access the following endpoint(s): https://login.salesforce.com/services/Soap/u/36.0</detail>
,code=<code>null</code>}
"

Will appreciate your help...
Hi All,

while working with integration class i am getting the following Error,
ErrormessageWeb service callout failed: WebService returned a SOAP Fault: faultcode=env:Client faultactor=

Please help me how to solve this issue.

Thanks in Advance.
Hello every one,

how to fetch 2nd record by SOQL query, with out using  offset.

my qyery: select id,createdDate,End_Date__c,Employee__c from Organization__c where ahm__Employee__c = 'a0Z37000001xwfP' order by CreatedDate DESC limit 1 offset 1

but with out using offset , because batch class will not accept the offser.

Thanks in advance.
HI all

i am trying to validate email in correct formate and seprator between 2 emails.

if text area consists as " test@test.com, test1@test.com " its should not show any errors. it should be seperated by comma( , ).

if text area consists as " test@test.com; test1@test.com " its should show an errors.

semi-colon should not be entered.

Please help in doing this.
Hi All 

can any one help in writter a trigger,

when parent is deleted the related child records should be deleted.

Thanks in advance.
Hi all,

i am new to apex classes i am tying to cover test class for the following lines, please help ne to write the test class.

code: 

public class ClientProjectCon {
    
    ApexPages.StandardController sc = null;
    
    public ClientProjectCon(ApexPages.StandardController controller) {
        this.sc = sc;
    }
    
    public pagereference Redirect()
    {
        
        Profile VRMProfile = [select name from Profile where id =:UserInfo.getProfileId()];
        
        if ('19_VRM_Contractor_Management'.equals(VRMProfile.name))
        {
               String hostname = ApexPages.currentPage().getHeaders().get('Host'); 
               String PageURL = 'https://'+hostname+'/'+'/a2c/e?nooverride=1';
               pagereference pageref1 = new pagereference(PageURL);
               pageref1.setredirect(true);
               return pageref1;
        }
        else if(ApexPages.currentPage().getParameters().get('RecordType') == '0122550002308cr') 
         {
               String hostname = ApexPages.currentPage().getHeaders().get('Host'); 
               String PageURL = 'https://'+hostname+'/'+'/a2e/e?nooverride=1';
               pagereference pageref1 = new pagereference(PageURL);
               pageref1.setredirect(true);
               return pageref1;
         }
         
        else{
              return null;
             }
    }

}
 
Hi all,

i need some help in making mouse hover content to be displayed. i need t display some content when i palce mouse on perticular word in question.

contnt to be displayed:
" In ancient manuscripts, another means to divide sentences into paragraphs was a line break (newline) followed by an initial at the beginning of the next paragraph. 

An initial is an oversize capital letter, sometimes outdented beyond the margin of text. This style can be seen, for example, in the original Old English manuscript of Beowulf.

Outdenting is still used in English typography, though not commonly.[4] Modern English typography usually indicates a new paragraph by indenting the first line. 

This style can be seen in the (handwritten) United States Constitution from 1787. For additional ornamentation, a hedera leaf or other symbol can be added to the inter-paragraph whitespace, or put in the indentation space. "

sample Question:
Q) what is the best paragrah is to be selecte for newly assignes.

when i place the pointer on "Paragraph" i need to display the whole paras shown above in visualforce page.

Thanks in Advance.
Hi all,

i need help in making mouse hover content to be displayed. i need t display some content when i palce mouse on perticular word in question.

contnt to be displayed:
" In ancient manuscripts, another means to divide sentences into paragraphs was a line break (newline) followed by an initial at the beginning of the next paragraph. 

An initial is an oversize capital letter, sometimes outdented beyond the margin of text. This style can be seen, for example, in the original Old English manuscript of Beowulf.

Outdenting is still used in English typography, though not commonly.[4] Modern English typography usually indicates a new paragraph by indenting the first line. 

This style can be seen in the (handwritten) United States Constitution from 1787. For additional ornamentation, a hedera leaf or other symbol can be added to the inter-paragraph whitespace, or put in the indentation space. "

sample Question:
Q) what is the best paragrah is to be selecte for newly assignes.

when i place the pointer on "Paragraph" i need to display the whole paras shown above in visualforce page.

Thanks in Advance.
Hi all , 
I had a requirement to calcualte number of holidays betwwn two days using Business hours Holidays.
Any one can provide the code for it.


Thanks in advance.
Hi to write the test code coverage for the folowing lines.

PageReference pageRef = new PageReference('/apex/Form_Thankyou?taskid='+taskid);
pageRef.setRedirect(true);
return pageRef;

Thanks in advance.
Hi all,
 
hoe to write the code coverage for the following lines,

private void getAttachmentInfo(){
        listAttachments = [SELECT ParentId , Name,  BodyLength,  Id,   CreatedDate     FROM  Attachment   WHERE ParentId = :taskid
                            ORDER BY CreatedDate DESC   LIMIT 50 ];    
    
        for(Attachment a : listAttachments) {
            String size = null;
            if(1048576 < a.BodyLength){
                // Size greater than 1MB
                size = '' + (a.BodyLength / 1048576) + ' MB';
            }
            else if(1024 < a.BodyLength){
                // Size greater than 1KB
                size = '' + (a.BodyLength / 1024) + ' KB';            
            }
            else{
                size = '' + a.BodyLength + ' bytes';
            }
            mapAttachmentSize.put(a.id, size);
        }
    }
Hi All,

i am trying to insert records for custom object using CSV File in Visual force page. But i am not able to insrt 200 records at a time.
i can use dataloader but its my requirement

I am trying with this refence link.
http://www.sfdcpoint.com/salesforce/import-csv-file-using-apex-visualforce/

Please help me to insert 6000 records in object.

Thanks in advance.
Hi All,

i am trying to insert records for Account using CSV File in Visual force page. But i am not able to insrt 200 records at a time.

I am trying with this refence link.
http://www.sfdcpoint.com/salesforce/import-csv-file-using-apex-visualforce/

Please help me to insert 6000 records in object.

Thanks in advance.
hi all,

I wrote a test class but i am unable to cover the test coverage for that ineed below sample code
I am retriving case object fields in controller based on ID in URL.
And updating the same object with new fields.

can any one give the sample test class for this.

Thanks in Advance.
hi all,

I am retriving case object fields in controller based on ID in URL.
And updating the same object with new fields.

can any one give the sample test class for this.

Thanks in Advance.
Hi all.

i am getting the time formate as "2016-03-03T01:09:36.933" from external system, its EST time.
i need to convert as local time.

ex: MM/DD/YYYY HH:MM

note time should be exactly shown in the formate no changes like Zeros should come.

Thanks in Advance.
Hi all,

How to over ride the created date in the test class as past date.
Can any one he me providing the code.

Thanks in advance.
I'm trying to write a test class for the following class, but I'm only covering 25% of the lines. How can I edit it to cover the  if conditions?

class :

global class Wct_OfferPendingforAnalyst implements Database.Batchable<sObject>,Schedulable{

    global Database.QueryLocator start(Database.BatchableContext BC)
    {
        String strSql = 'SELECT Id,CreatedDate,Name,RecordTypeID,Owner.Email,WCT_Created_Date_Time__c,WCT_Candidate_Email__c,WCT_Team_Mailbox__c,WCT_RMS_ID__c,WCT_Full_Name__c,WCT_status__c,WCT_AgentState_Time__c, WCT_User_Group__c' +
                     ' FROM WCT_Offer__c'+
                     ' where WCT_status__c IN (\'Offer to Be Extended\', \'Draft in Progress\', \'Returned for Revisions\')'+
                     ' AND owner.email != null'+
                     ' AND RecordType.Name IN (\'US Experienced Hire Offer\', \'US Campus Hire Offer\')'; 
        system.debug('query123******'+strSql);
        return database.getQuerylocator(strSql);
        
    }

    global void execute(Database.BatchableContext BC, List<WCT_Offer__c> scope)
    {
        List<Messaging.SingleEmailMessage> mailList = new List<Messaging.SingleEmailMessage>();
        List<Messaging.SingleEmailMessage> mailList2 = new List<Messaging.SingleEmailMessage>();
        
        set<string> setRecEmails = new set<string>();
        set<string> setteamEmails = new set<string>();
        map<string,string> RecTeamEmails = new map<string,string>();
        map<string,string> RecTeamEmails2 = new map<string,string>();
        
        Map<String, List<WCT_Offer__c>> recOffers = new Map<String, List<WCT_Offer__c>>(); 
        Map<String, List<WCT_Offer__c>> recOffers2 = new Map<String, List<WCT_Offer__c>>();
        
        Map<ID, Schema.RecordTypeInfo> rtMap = Schema.SObjectType.WCT_Offer__c.getRecordTypeInfosById();
        Decimal seconds;
        Decimal hrs;
        Decimal min;
        
        
        for(WCT_Offer__c tmp : scope) {
             WCT_Offer__c offerRecord = (WCT_Offer__c) tmp;
             WCT_Offer__c offerRecord2 = (WCT_Offer__c) tmp;
            
             datetime recorddatetime = date.valueof(offerRecord.CreatedDate);
             system.debug('dt**********'+recorddatetime);
             
             seconds = BusinessHours.diff(Label.WCT_Default_Business_Hours_ID, offerRecord.WCT_Created_Date_Time__c, System.now())/ 1000;
             
             system.debug('Label.WCT_Default_Business_Hours_ID**********'+Label.WCT_Default_Business_Hours_ID);
             
             min = Integer.valueOf(seconds / 60);
             hrs = Integer.valueOf(seconds / 3600);
             system.debug('seconds**********'+seconds);
             system.debug('hrs11**********'+hrs);
             system.debug('min**********'+min);
             
             system.debug('recordtype**********'+rtMap.get(offerRecord.RecordTypeId).getName());
             //-------------------1st---------------------------
             
             if(rtMap.get(offerRecord.RecordTypeId).getName() == 'US Experienced Hire Offer' &&  min >=238 && min < 257) { 
                 system.debug('recordtype1**********'+rtMap.get(offerRecord.RecordTypeId).getName());
                setRecEmails.add(offerRecord.Owner.Email);
                RecTeamEmails.put(offerRecord.Owner.Email,offerRecord.WCT_Team_Mailbox__c);
                system.debug('RecTeamEmails:'+RecTeamEmails);
                List<WCT_Offer__c> offerList = recOffers.get(offerRecord.Owner.Email);
                if(offerList == null) {
                    offerList = new List<WCT_Offer__c>();
                } 
                offerList.add(offerRecord);
                recOffers.put(offerRecord.Owner.Email,offerList);
            }
            //-------------------2nd---------------------------
           if(rtMap.get(offerRecord2.RecordTypeId).getName() == 'US Experienced Hire Offer' && min >=358 && min < 377) {   //hrs >= 6 && hrs < 7
                system.debug('alert2**********');
                setRecEmails.add(offerRecord2.Owner.Email);
                RecTeamEmails2.put(offerRecord2.Owner.Email,offerRecord2.WCT_Team_Mailbox__c);
                system.debug('RecTeamEmails2:'+RecTeamEmails2);
                List<WCT_Offer__c> offerList2 = recOffers2.get(offerRecord2.Owner.Email);
                if(offerList2 == null) {
                    offerList2 = new List<WCT_Offer__c>();
                } 
                offerList2.add(offerRecord2);
                recOffers2.put(offerRecord2.Owner.Email,offerList2);
            }
            
        }
        
        
        
        String strEmailTop ='';
        String strEmailBody ='';
        String strEmailBottom ='';
        /*
        strEmailTop  += '<!DOCTYPE html> <html> <head> <style> table,th,td { border: 1px solid black; border-collapse:collapse; }, th,td { padding:5px; } </style> </head> <body> <br> Dear Analyst,<br> <br>';
        strEmailTop  += 'Offer Letter(s) are pending for more than 4 Hours.';
        strEmailTop  += ' <br> <br> <br> <table> <thead> <tr> <th>Offer Name</th> <th>Candidate Name</th> <th>RMS ID</th> <th>Candidate Email</th> <th>Status</th> <th>Offer letter link</th> </tr> </thead> <tbody>';
        
        strEmailBottom += '</tbody> </table> <br> Thank you,<br> Deloitte Recruting.<br> </body> </html>';
        */
        
        for(string strRecEmail: recOffers.keyset()) {
            strEmailBody ='';
            for(WCT_Offer__c offerRecord : recOffers.get(strRecEmail)) {
                
                strEmailTop  += '<!DOCTYPE html> <html> <head> <style> table,th,td { border: 1px solid black; border-collapse:collapse; }, th,td { padding:5px; } </style> </head> <body> <br> Dear Analyst,<br> <br>';
                strEmailTop  += 'Offer Letter(s) are pending for more than 4 Hours.';
                strEmailTop  += ' <br> <br> <br> <table> <thead> <tr> <th>Offer Name</th> <th>Candidate Name</th> <th>RMS ID</th> <th>Candidate Email</th> <th>Status</th> <th>Offer letter link</th> </tr> </thead> <tbody>';
                
                strEmailBody += '<tr> <td>'+offerRecord.Name+'</td> <td>'+offerRecord.WCT_full_Name__c+'</td><td>'+offerRecord.WCT_RMS_ID__c+'</td><td>'+offerRecord.WCT_Candidate_Email__c+'</td>';
                strEmailBody += '<td>'+offerRecord.WCT_status__c+'</td><td><a href='+Label.BaseURL+'/'+offerRecord.id+'>URL</a></td></tr>';
                
                strEmailBottom += '</tbody> </table> <br> Thank you,<br> Deloitte Recruting.<br> </body> </html>';
            }
            list<string> ToEmailAddress = new list<string>();
            List<string> ToCcAddress = new List<string>();
            
            Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
            ToEmailAddress.add(strRecEmail);
            system.debug('strRecEmail1:'+strRecEmail);
            if(RecTeamEmails != null && RecTeamEmails.get(strRecEmail) != null){
                 ToCcAddress.add(RecTeamEmails.get(strRecEmail));
            }
            system.debug('strRecEmail:'+strRecEmail);
            system.debug('ToCcAddress:'+ToCcAddress);
            
            mail.settoAddresses(ToEmailAddress);
            system.debug('ToEmailAddress:'+ToEmailAddress);
            mail.setccAddresses(ToCcAddress);
            system.debug('ToCcAddress1:'+ToCcAddress);
            mail.setSubject('1st Alert Immediate Action: Offer Letter(s) are pending');
            
            mail.setHTMLBody('<font color="green">'+strEmailTop+'</font>'+'<font color="green">'+strEmailBody+'</font>'+'<font color="green">'+strEmailBottom+'</font>');
            mail.setSaveAsActivity(false);
            mailList.add(mail);  
        
        }
        //------------------2nd------------------------------------------------------------------------------------------------
        for(string strRecEmail2 : recOffers2.keyset()) {
            strEmailBody ='';
            for(WCT_Offer__c offerRecord2 : recOffers2.get(strRecEmail2)) {
                strEmailTop  += '<!DOCTYPE html> <html> <head> <style> table,th,td { border: 1px solid black; border-collapse:collapse; }, th,td { padding:5px; } </style> </head> <body> <br> Dear Analyst,<br> <br>';
                strEmailTop  += 'Offer Letter(s) are pending for more than 6 Hours.';
                strEmailTop  += ' <br> <br> <br> <table> <thead> <tr> <th>Offer Name</th> <th>Candidate Name</th> <th>RMS ID</th> <th>Candidate Email</th> <th>Status</th> <th>Offer letter link</th> </tr> </thead> <tbody>';
                
                strEmailBody += '<tr> <td>'+offerRecord2.Name+'</td> <td>'+offerRecord2.WCT_full_Name__c+'</td><td>'+offerRecord2.WCT_RMS_ID__c+'</td><td>'+offerRecord2.WCT_Candidate_Email__c+'</td>';
                strEmailBody += '<td>'+offerRecord2.WCT_status__c+'</td><td><a href='+Label.BaseURL+'/'+offerRecord2.id+'>URL</a></td></tr>';
                
                strEmailBottom += '</tbody> </table> <br> Thank you,<br> Deloitte Recruting.<br> </body> </html>';
            }
            list<string> ToEmailAddress2 = new list<string>();
            List<string> ToCcAddress2 = new List<string>();
            Messaging.SingleEmailMessage mail2 = new Messaging.SingleEmailMessage();
            ToEmailAddress2.add(strRecEmail2);
            system.debug('strRecEmail2:'+strRecEmail2);
            if(RecTeamEmails2 != null && RecTeamEmails2.get(strRecEmail2) != null){
                 ToCcAddress2.add(RecTeamEmails2.get(strRecEmail2));
            }
            system.debug('strRecEmail2:'+strRecEmail2);
            system.debug('ToCcAddress:'+ToCcAddress2);
            mail2.settoAddresses(ToEmailAddress2);
            system.debug('ToEmailAddress:'+ToEmailAddress2);
                ToCcAddress2.add('pjamalapuram@deloitte.com');
                ToCcAddress2.add('rkomma@deloitte.com');
            mail2.setccAddresses(ToCcAddress2);
            system.debug('ToCcAddress1:'+ToCcAddress2);
            mail2.setSubject('2nd Alert Immediate Action: Offer Letter(s) are pending');
            
            mail2.setHTMLBody('<font color="orange">'+strEmailTop+'</font>'+'<font color="orange">'+strEmailBody+'</font>'+'<font color="orange">'+strEmailBottom+'</font>');
            
            mail2.setSaveAsActivity(false);
            mailList2.add(mail2);  
        }
            Messaging.sendEmail(mailList); 
            Messaging.sendEmail(mailList2);
    }

    global void finish(Database.BatchableContext BC){
    }
}
Test class: 

@isTest
public class Wct_OfferPendingforAnalyst_Test{
    static Id employeeRecordTypeId = Schema.SObjectType.Contact.getRecordTypeInfosByName().get('Employee').getRecordTypeId();
    static testMethod void Wct_OfferPendingforAnalyst_TestMethod (){
     Profile prof = [select id from profile where name='system Administrator'];
     User usr = new User(alias = 'usr', email='us.name@vmail.com',
                emailencodingkey='UTF-8', lastname='lstname',
                timezonesidkey='America/Los_Angeles',
                languagelocalekey='en_US',
                localesidkey='en_US', profileid = prof.Id,
                username='testuser128@testorg.com');
                insert usr;
    
       Account acc = new Account();
       acc.Name='Test';
       Insert acc;
       system.debug('acc values ----'+acc);
       
       Contact con = new Contact ();
       con.AccountId= acc.Id;
       con.LastName='tec';
       con.Email='user@gmail.com';
       Insert con;
       
        List<Messaging.SingleEmailMessage> mailList = new List<Messaging.SingleEmailMessage>();
        List<Messaging.SingleEmailMessage> mailList2 = new List<Messaging.SingleEmailMessage>();
        set<string> setRecEmails = new set<string>();
        set<string> setteamEmails = new set<string>();
        map<string,string> RecTeamEmails = new map<string,string>();
        map<string,string> RecTeamEmails2 = new map<string,string>();
        Map<String, List<WCT_Offer__c>> recOffers = new Map<String, List<WCT_Offer__c>>(); 
        Map<String, List<WCT_Offer__c>> recOffers2 = new Map<String, List<WCT_Offer__c>>();
        Map<ID, Schema.RecordTypeInfo> rtMap = Schema.SObjectType.WCT_Offer__c.getRecordTypeInfosById();
        
        recordtype rc1 = [SELECT Id FROM RecordType WHERE SObjectType = 'WCT_Offer__c' limit 1];
        WCT_Offer__c oppty = new WCT_Offer__c();
        oppty.recordtypeid = rc1.id;
    
       WCT_Offer__c  objCusWct= new WCT_Offer__c();
        
        objCusWct.RecordTypeId = '01240000000QLiP';
        objCusWct.WCT_status__c = 'Offer to Be Extended';
        objCusWct.WCT_Candidate__c = con.Id;
        objCusWct.WCT_Recruiter__c = con.id;
        objCusWct.WCT_Recruiter__c = con.Id;
        objCusWct.WCT_Team_Mailbox__c = 'test@deloitte.com';
        objCusWct.WCT_Type_of_Hire__c = 'Full time';
        objCusWct.OwnerId = usr.id;
        insert objCusWct;
        objCusWct.recalculateformulas();  
        WCT_Offer__c  ls =   [select id,createddate from WCT_Offer__c  where id =: objCusWct.id limit 1];
         List<BusinessHours> bhs=[select id from BusinessHours where IsDefault=true];     
         Decimal  seconds = BusinessHours.diff(Label.WCT_Default_Business_Hours_ID, objCusWct.WCT_Created_Date_Time__c, System.now())/ 1000;
             
        Decimal       hrs = Integer.valueOf(seconds / 3600);
        Decimal      min = Integer.valueOf(hrs/60);   
        
        Test.StartTest();
        Wct_OfferPendingforAnalyst objBatch = new Wct_OfferPendingforAnalyst();
        ID batchprocessid = Database.executeBatch(objBatch);
        Test.StopTest();
          
    }
}


Thanks in advance
Hi all,

i need help in making mouse hover content to be displayed. i need t display some content when i palce mouse on perticular word in question.

contnt to be displayed:
" In ancient manuscripts, another means to divide sentences into paragraphs was a line break (newline) followed by an initial at the beginning of the next paragraph. 

An initial is an oversize capital letter, sometimes outdented beyond the margin of text. This style can be seen, for example, in the original Old English manuscript of Beowulf.

Outdenting is still used in English typography, though not commonly.[4] Modern English typography usually indicates a new paragraph by indenting the first line. 

This style can be seen in the (handwritten) United States Constitution from 1787. For additional ornamentation, a hedera leaf or other symbol can be added to the inter-paragraph whitespace, or put in the indentation space. "

sample Question:
Q) what is the best paragrah is to be selecte for newly assignes.

when i place the pointer on "Paragraph" i need to display the whole paras shown above in visualforce page.

Thanks in Advance.
Hi all , 
I had a requirement to calcualte number of holidays betwwn two days using Business hours Holidays.
Any one can provide the code for it.


Thanks in advance.
Hi All,

i am trying to insert records for Account using CSV File in Visual force page. But i am not able to insrt 200 records at a time.

I am trying with this refence link.
http://www.sfdcpoint.com/salesforce/import-csv-file-using-apex-visualforce/

Please help me to insert 6000 records in object.

Thanks in advance.
hi all,

I am retriving case object fields in controller based on ID in URL.
And updating the same object with new fields.

can any one give the sample test class for this.

Thanks in Advance.
Hi all.

i am getting the time formate as "2016-03-03T01:09:36.933" from external system, its EST time.
i need to convert as local time.

ex: MM/DD/YYYY HH:MM

note time should be exactly shown in the formate no changes like Zeros should come.

Thanks in Advance.
Hi all,

How to over ride the created date in the test class as past date.
Can any one he me providing the code.

Thanks in advance.
I'm trying to write a test class for the following class, but I'm only covering 25% of the lines. How can I edit it to cover the  if conditions?

class :

global class Wct_OfferPendingforAnalyst implements Database.Batchable<sObject>,Schedulable{

    global Database.QueryLocator start(Database.BatchableContext BC)
    {
        String strSql = 'SELECT Id,CreatedDate,Name,RecordTypeID,Owner.Email,WCT_Created_Date_Time__c,WCT_Candidate_Email__c,WCT_Team_Mailbox__c,WCT_RMS_ID__c,WCT_Full_Name__c,WCT_status__c,WCT_AgentState_Time__c, WCT_User_Group__c' +
                     ' FROM WCT_Offer__c'+
                     ' where WCT_status__c IN (\'Offer to Be Extended\', \'Draft in Progress\', \'Returned for Revisions\')'+
                     ' AND owner.email != null'+
                     ' AND RecordType.Name IN (\'US Experienced Hire Offer\', \'US Campus Hire Offer\')'; 
        system.debug('query123******'+strSql);
        return database.getQuerylocator(strSql);
        
    }

    global void execute(Database.BatchableContext BC, List<WCT_Offer__c> scope)
    {
        List<Messaging.SingleEmailMessage> mailList = new List<Messaging.SingleEmailMessage>();
        List<Messaging.SingleEmailMessage> mailList2 = new List<Messaging.SingleEmailMessage>();
        
        set<string> setRecEmails = new set<string>();
        set<string> setteamEmails = new set<string>();
        map<string,string> RecTeamEmails = new map<string,string>();
        map<string,string> RecTeamEmails2 = new map<string,string>();
        
        Map<String, List<WCT_Offer__c>> recOffers = new Map<String, List<WCT_Offer__c>>(); 
        Map<String, List<WCT_Offer__c>> recOffers2 = new Map<String, List<WCT_Offer__c>>();
        
        Map<ID, Schema.RecordTypeInfo> rtMap = Schema.SObjectType.WCT_Offer__c.getRecordTypeInfosById();
        Decimal seconds;
        Decimal hrs;
        Decimal min;
        
        
        for(WCT_Offer__c tmp : scope) {
             WCT_Offer__c offerRecord = (WCT_Offer__c) tmp;
             WCT_Offer__c offerRecord2 = (WCT_Offer__c) tmp;
            
             datetime recorddatetime = date.valueof(offerRecord.CreatedDate);
             system.debug('dt**********'+recorddatetime);
             
             seconds = BusinessHours.diff(Label.WCT_Default_Business_Hours_ID, offerRecord.WCT_Created_Date_Time__c, System.now())/ 1000;
             
             system.debug('Label.WCT_Default_Business_Hours_ID**********'+Label.WCT_Default_Business_Hours_ID);
             
             min = Integer.valueOf(seconds / 60);
             hrs = Integer.valueOf(seconds / 3600);
             system.debug('seconds**********'+seconds);
             system.debug('hrs11**********'+hrs);
             system.debug('min**********'+min);
             
             system.debug('recordtype**********'+rtMap.get(offerRecord.RecordTypeId).getName());
             //-------------------1st---------------------------
             
             if(rtMap.get(offerRecord.RecordTypeId).getName() == 'US Experienced Hire Offer' &&  min >=238 && min < 257) { 
                 system.debug('recordtype1**********'+rtMap.get(offerRecord.RecordTypeId).getName());
                setRecEmails.add(offerRecord.Owner.Email);
                RecTeamEmails.put(offerRecord.Owner.Email,offerRecord.WCT_Team_Mailbox__c);
                system.debug('RecTeamEmails:'+RecTeamEmails);
                List<WCT_Offer__c> offerList = recOffers.get(offerRecord.Owner.Email);
                if(offerList == null) {
                    offerList = new List<WCT_Offer__c>();
                } 
                offerList.add(offerRecord);
                recOffers.put(offerRecord.Owner.Email,offerList);
            }
            //-------------------2nd---------------------------
           if(rtMap.get(offerRecord2.RecordTypeId).getName() == 'US Experienced Hire Offer' && min >=358 && min < 377) {   //hrs >= 6 && hrs < 7
                system.debug('alert2**********');
                setRecEmails.add(offerRecord2.Owner.Email);
                RecTeamEmails2.put(offerRecord2.Owner.Email,offerRecord2.WCT_Team_Mailbox__c);
                system.debug('RecTeamEmails2:'+RecTeamEmails2);
                List<WCT_Offer__c> offerList2 = recOffers2.get(offerRecord2.Owner.Email);
                if(offerList2 == null) {
                    offerList2 = new List<WCT_Offer__c>();
                } 
                offerList2.add(offerRecord2);
                recOffers2.put(offerRecord2.Owner.Email,offerList2);
            }
            
        }
        
        
        
        String strEmailTop ='';
        String strEmailBody ='';
        String strEmailBottom ='';
        /*
        strEmailTop  += '<!DOCTYPE html> <html> <head> <style> table,th,td { border: 1px solid black; border-collapse:collapse; }, th,td { padding:5px; } </style> </head> <body> <br> Dear Analyst,<br> <br>';
        strEmailTop  += 'Offer Letter(s) are pending for more than 4 Hours.';
        strEmailTop  += ' <br> <br> <br> <table> <thead> <tr> <th>Offer Name</th> <th>Candidate Name</th> <th>RMS ID</th> <th>Candidate Email</th> <th>Status</th> <th>Offer letter link</th> </tr> </thead> <tbody>';
        
        strEmailBottom += '</tbody> </table> <br> Thank you,<br> Deloitte Recruting.<br> </body> </html>';
        */
        
        for(string strRecEmail: recOffers.keyset()) {
            strEmailBody ='';
            for(WCT_Offer__c offerRecord : recOffers.get(strRecEmail)) {
                
                strEmailTop  += '<!DOCTYPE html> <html> <head> <style> table,th,td { border: 1px solid black; border-collapse:collapse; }, th,td { padding:5px; } </style> </head> <body> <br> Dear Analyst,<br> <br>';
                strEmailTop  += 'Offer Letter(s) are pending for more than 4 Hours.';
                strEmailTop  += ' <br> <br> <br> <table> <thead> <tr> <th>Offer Name</th> <th>Candidate Name</th> <th>RMS ID</th> <th>Candidate Email</th> <th>Status</th> <th>Offer letter link</th> </tr> </thead> <tbody>';
                
                strEmailBody += '<tr> <td>'+offerRecord.Name+'</td> <td>'+offerRecord.WCT_full_Name__c+'</td><td>'+offerRecord.WCT_RMS_ID__c+'</td><td>'+offerRecord.WCT_Candidate_Email__c+'</td>';
                strEmailBody += '<td>'+offerRecord.WCT_status__c+'</td><td><a href='+Label.BaseURL+'/'+offerRecord.id+'>URL</a></td></tr>';
                
                strEmailBottom += '</tbody> </table> <br> Thank you,<br> Deloitte Recruting.<br> </body> </html>';
            }
            list<string> ToEmailAddress = new list<string>();
            List<string> ToCcAddress = new List<string>();
            
            Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
            ToEmailAddress.add(strRecEmail);
            system.debug('strRecEmail1:'+strRecEmail);
            if(RecTeamEmails != null && RecTeamEmails.get(strRecEmail) != null){
                 ToCcAddress.add(RecTeamEmails.get(strRecEmail));
            }
            system.debug('strRecEmail:'+strRecEmail);
            system.debug('ToCcAddress:'+ToCcAddress);
            
            mail.settoAddresses(ToEmailAddress);
            system.debug('ToEmailAddress:'+ToEmailAddress);
            mail.setccAddresses(ToCcAddress);
            system.debug('ToCcAddress1:'+ToCcAddress);
            mail.setSubject('1st Alert Immediate Action: Offer Letter(s) are pending');
            
            mail.setHTMLBody('<font color="green">'+strEmailTop+'</font>'+'<font color="green">'+strEmailBody+'</font>'+'<font color="green">'+strEmailBottom+'</font>');
            mail.setSaveAsActivity(false);
            mailList.add(mail);  
        
        }
        //------------------2nd------------------------------------------------------------------------------------------------
        for(string strRecEmail2 : recOffers2.keyset()) {
            strEmailBody ='';
            for(WCT_Offer__c offerRecord2 : recOffers2.get(strRecEmail2)) {
                strEmailTop  += '<!DOCTYPE html> <html> <head> <style> table,th,td { border: 1px solid black; border-collapse:collapse; }, th,td { padding:5px; } </style> </head> <body> <br> Dear Analyst,<br> <br>';
                strEmailTop  += 'Offer Letter(s) are pending for more than 6 Hours.';
                strEmailTop  += ' <br> <br> <br> <table> <thead> <tr> <th>Offer Name</th> <th>Candidate Name</th> <th>RMS ID</th> <th>Candidate Email</th> <th>Status</th> <th>Offer letter link</th> </tr> </thead> <tbody>';
                
                strEmailBody += '<tr> <td>'+offerRecord2.Name+'</td> <td>'+offerRecord2.WCT_full_Name__c+'</td><td>'+offerRecord2.WCT_RMS_ID__c+'</td><td>'+offerRecord2.WCT_Candidate_Email__c+'</td>';
                strEmailBody += '<td>'+offerRecord2.WCT_status__c+'</td><td><a href='+Label.BaseURL+'/'+offerRecord2.id+'>URL</a></td></tr>';
                
                strEmailBottom += '</tbody> </table> <br> Thank you,<br> Deloitte Recruting.<br> </body> </html>';
            }
            list<string> ToEmailAddress2 = new list<string>();
            List<string> ToCcAddress2 = new List<string>();
            Messaging.SingleEmailMessage mail2 = new Messaging.SingleEmailMessage();
            ToEmailAddress2.add(strRecEmail2);
            system.debug('strRecEmail2:'+strRecEmail2);
            if(RecTeamEmails2 != null && RecTeamEmails2.get(strRecEmail2) != null){
                 ToCcAddress2.add(RecTeamEmails2.get(strRecEmail2));
            }
            system.debug('strRecEmail2:'+strRecEmail2);
            system.debug('ToCcAddress:'+ToCcAddress2);
            mail2.settoAddresses(ToEmailAddress2);
            system.debug('ToEmailAddress:'+ToEmailAddress2);
                ToCcAddress2.add('pjamalapuram@deloitte.com');
                ToCcAddress2.add('rkomma@deloitte.com');
            mail2.setccAddresses(ToCcAddress2);
            system.debug('ToCcAddress1:'+ToCcAddress2);
            mail2.setSubject('2nd Alert Immediate Action: Offer Letter(s) are pending');
            
            mail2.setHTMLBody('<font color="orange">'+strEmailTop+'</font>'+'<font color="orange">'+strEmailBody+'</font>'+'<font color="orange">'+strEmailBottom+'</font>');
            
            mail2.setSaveAsActivity(false);
            mailList2.add(mail2);  
        }
            Messaging.sendEmail(mailList); 
            Messaging.sendEmail(mailList2);
    }

    global void finish(Database.BatchableContext BC){
    }
}
Test class: 

@isTest
public class Wct_OfferPendingforAnalyst_Test{
    static Id employeeRecordTypeId = Schema.SObjectType.Contact.getRecordTypeInfosByName().get('Employee').getRecordTypeId();
    static testMethod void Wct_OfferPendingforAnalyst_TestMethod (){
     Profile prof = [select id from profile where name='system Administrator'];
     User usr = new User(alias = 'usr', email='us.name@vmail.com',
                emailencodingkey='UTF-8', lastname='lstname',
                timezonesidkey='America/Los_Angeles',
                languagelocalekey='en_US',
                localesidkey='en_US', profileid = prof.Id,
                username='testuser128@testorg.com');
                insert usr;
    
       Account acc = new Account();
       acc.Name='Test';
       Insert acc;
       system.debug('acc values ----'+acc);
       
       Contact con = new Contact ();
       con.AccountId= acc.Id;
       con.LastName='tec';
       con.Email='user@gmail.com';
       Insert con;
       
        List<Messaging.SingleEmailMessage> mailList = new List<Messaging.SingleEmailMessage>();
        List<Messaging.SingleEmailMessage> mailList2 = new List<Messaging.SingleEmailMessage>();
        set<string> setRecEmails = new set<string>();
        set<string> setteamEmails = new set<string>();
        map<string,string> RecTeamEmails = new map<string,string>();
        map<string,string> RecTeamEmails2 = new map<string,string>();
        Map<String, List<WCT_Offer__c>> recOffers = new Map<String, List<WCT_Offer__c>>(); 
        Map<String, List<WCT_Offer__c>> recOffers2 = new Map<String, List<WCT_Offer__c>>();
        Map<ID, Schema.RecordTypeInfo> rtMap = Schema.SObjectType.WCT_Offer__c.getRecordTypeInfosById();
        
        recordtype rc1 = [SELECT Id FROM RecordType WHERE SObjectType = 'WCT_Offer__c' limit 1];
        WCT_Offer__c oppty = new WCT_Offer__c();
        oppty.recordtypeid = rc1.id;
    
       WCT_Offer__c  objCusWct= new WCT_Offer__c();
        
        objCusWct.RecordTypeId = '01240000000QLiP';
        objCusWct.WCT_status__c = 'Offer to Be Extended';
        objCusWct.WCT_Candidate__c = con.Id;
        objCusWct.WCT_Recruiter__c = con.id;
        objCusWct.WCT_Recruiter__c = con.Id;
        objCusWct.WCT_Team_Mailbox__c = 'test@deloitte.com';
        objCusWct.WCT_Type_of_Hire__c = 'Full time';
        objCusWct.OwnerId = usr.id;
        insert objCusWct;
        objCusWct.recalculateformulas();  
        WCT_Offer__c  ls =   [select id,createddate from WCT_Offer__c  where id =: objCusWct.id limit 1];
         List<BusinessHours> bhs=[select id from BusinessHours where IsDefault=true];     
         Decimal  seconds = BusinessHours.diff(Label.WCT_Default_Business_Hours_ID, objCusWct.WCT_Created_Date_Time__c, System.now())/ 1000;
             
        Decimal       hrs = Integer.valueOf(seconds / 3600);
        Decimal      min = Integer.valueOf(hrs/60);   
        
        Test.StartTest();
        Wct_OfferPendingforAnalyst objBatch = new Wct_OfferPendingforAnalyst();
        ID batchprocessid = Database.executeBatch(objBatch);
        Test.StopTest();
          
    }
}


Thanks in advance
Hi All,

I am creating a case in case object when record is created i will get mail.
1) In the case object i had attachment
2) what ever mail i am geeting. i need to attach the attachment which is in case record.
3) i am using email template in sfdc (adminstrator > communication template > email template)

please help me in doing that.

Thanks in Advance.
Hi all,

I am writing test class, and its covered 42%.
so by using dummy data, how to cover the code. please help me to cover the code its urgent.

thanks in Advance.
Hi All,
How to write test method for following code, please help me.

public class UpdateContactController {
public class MyWrapper
    {
      public string BenifitPlan1{get; set;}
      public Integer PersonnelNumber1 {get; set;}
      public Integer PlanNumber1 {get; set;}
      public string DependentPlan1 {get; set;}
      
      public MyWrapper(Integer PersonnelNumber,string BenifitPlan,string DependentPlan,Integer PlanNumber )  //
      {
          
          PersonnelNumber1 = PersonnelNumber;
          BenifitPlan1 = BenifitPlan;
          DependentPlan1 = DependentPlan;
          PlanNumber1 = PlanNumber;
          
      }
    }
}

Thanks in Advance
Hi All,

I am facing governer limit issue, how to bypass the limit.
this is my code , please Help me out, Advance thanks.

global class Wct_OfferPendingforAnalyst implements Database.Batchable<sObject>,Schedulable{

    global void execute(SchedulableContext SC) {
        Wct_OfferPendingforAnalyst batch = new Wct_OfferPendingforAnalyst();
        ID batchprocessid = Database.executeBatch(batch,100); 
    }
    
    global Database.QueryLocator start(Database.BatchableContext BC)
    {
        String strSql = 'SELECT Id,Name,Owner.Email,WCT_Candidate_Email__c,WCT_Team_Mailbox__c,WCT_RMS_ID__c,WCT_Full_Name__c,WCT_status__c,WCT_AgentState_Time__c' +
                     ' FROM WCT_Offer__c'+
                     ' where WCT_status__c IN (\'Offer to Be Extended\', \'Draft in Progress\', \'Returned for Revisions\')'+
                     ' AND owner.email != null AND WCT_AgentState_Time__c != null'; 
        system.debug('query123:'+strSql);
        return database.getQuerylocator(strSql);
        
    }

    global void execute(Database.BatchableContext BC, List<sObject> scope)
    {
        set<string> setRecEmails = new set<string>();
        set<string> setteamEmails = new set<string>();
        map<string,string> RecTeamEmails = new map<string,string>();
        Map<String, List<WCT_Offer__c>> recOffers = new Map<String, List<WCT_Offer__c>>(); 
        Decimal seconds;
        Decimal hrs;
        
        for(sObject tmp : scope) {
             WCT_Offer__c offerRecord = (WCT_Offer__c) tmp;
             seconds = BusinessHours.diff(Label.WCT_Default_Business_Hours_ID, offerRecord.WCT_AgentState_Time__c, System.now())/ 1000;
             hrs = seconds / 3600;
             if(hrs > 4) {
                setRecEmails.add(offerRecord.Owner.Email);
                RecTeamEmails.put(offerRecord.Owner.Email,offerRecord.WCT_Team_Mailbox__c);
                system.debug('RecTeamEmails:'+RecTeamEmails);
                List<WCT_Offer__c> offerList = recOffers.get(offerRecord.Owner.Email);
                if(offerList == null) {
                    offerList = new List<WCT_Offer__c>();
                } 
                offerList.add(offerRecord);
                recOffers.put(offerRecord.Owner.Email,offerList);
            }
        }
        
        String strEmailTop ='';
        String strEmailBody ='';
        String strEmailBottom ='';
        
        strEmailTop  += '<!DOCTYPE html>';
        strEmailTop  += '<html> <head> <style>';
        strEmailTop  += 'table,th,td';
        strEmailTop  += '{ border: 1px solid black; border-collapse:collapse; }, th,td';
        strEmailTop  += ' { padding:5px; }';
        strEmailTop  += '</style> </head> <body> <br> Dear Analyst,<br> <br>';
        strEmailTop  += 'Offer Letter(s) are pending for more than 4 Hours.<br> <br> <br> <table> <thead>';
        strEmailTop  += ' <tr> <th>Offer Name</th> <th>Candidate Name</th> <th>RMS ID</th> <th>Candidate Email</th> <th>Status</th> <th>Offer letter link</th>';
        strEmailTop  += '</tr> </thead> <tbody>';
        
        strEmailBottom += '</tbody> </table> <br> Thank you,<br> Deloitte Recruting.<br> </body> </html>';
        
        for(string strRecEmail: recOffers.keyset()) {
            strEmailBody ='';
            for(WCT_Offer__c offerRecord : recOffers.get(strRecEmail)) {
            
                    strEmailBody += '<tr> <td>'+offerRecord.Name+'</td> <td>'+offerRecord.WCT_full_Name__c+'</td><td>'+offerRecord.WCT_RMS_ID__c+'</td><td>'+offerRecord.WCT_Candidate_Email__c+'</td>';
                    strEmailBody += '<td>'+offerRecord.WCT_status__c+'</td><td><a href='+Label.BaseURL+'/'+offerRecord.id+'>URL</a></td></tr>';
            }
            
            list<string> ToEmailAddress = new list<string>();
            List<string> ToCcAddress = new List<string>();
            
            Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
            ToEmailAddress.add(strRecEmail);
            system.debug('strRecEmail1:'+strRecEmail);
            if(RecTeamEmails != null && RecTeamEmails.get(strRecEmail) != null){
                 ToCcAddress.add(RecTeamEmails.get(strRecEmail));
            }
            system.debug('strRecEmail:'+strRecEmail);
            system.debug('ToCcAddress:'+ToCcAddress);
            
            mail.settoAddresses(ToEmailAddress);
            system.debug('ToEmailAddress:'+ToEmailAddress);
            mail.setccAddresses(ToCcAddress);
            system.debug('ToCcAddress1:'+ToCcAddress);
            mail.setSubject('Immediate Action: Offer Letter(s) are pending');
            mail.setHTMLBody(strEmailTop+strEmailBody+strEmailBottom);
            mail.setSaveAsActivity(false);
            if(ToEmailAddress != null){
                Messaging.sendEmail(new Messaging.SingleEmailMessage [] {mail});
            }
        }
    }

    global void finish(Database.BatchableContext BC){
      
    }
}
Hi All,
can any one help me by giving code for vfpage
1) should contain stndard controller and extension
2) one input text and command Button
on loading page the textbox should be disable and when button is clicked it should get enabled. by using javascript.

please can any one give code for this.
 
Can any one can provide the facebook integration with clear steps i am trying since 2 months but i am not able to get please help or send the document to my mail id karthikv369@gmail.com, Thanking in advance. please help me
I have a visualforce page in that i have created two button
1) Export Excel
2)Export Pdf

I have written code for for bothexport page in excel and PDF using rerender and contettype.
Also i have added custom button on my visulforce page.
<apex:commandButton action="{!URLFOR($Action.Five_c.Generate, Id)}" id="pdf" value="pdf"/>
<apex:commandButton action="{!URLFOR($Action.Five_c.excel, Id)}" id="excel" value="excel"/>
Now the problem is once I click on pdf button it redirect to the pdf page .What my requirnment is that pdf should open in new window i.e child page and parent page should also visible to us.

Similary for Excel it should happen
Take one checkbox on contact object.
Have only one primary contact from multiple contact in Account.
Avoid multiple primary contact from Trigger.
hii , my requirement is to calculate hours between two dates according to my bussiness hours .
my bussiness hours is 10:00AM to 7 :00PM and  Saturday and sunday holiday .

Is there a way to rename Quotes to Order Forms & Invoices?

 

Thanks,