• Surgaya Khundrakpam
  • 10 Points
  • Member since 2014

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
  • 10
Visualforce page gives unresponsive error while loading records around 2000+.
I added readOnly= true in the apex:Page tag but didn't help.

But still I am getting this error . Please help.
User-added image
public with sharing class UtilityClass {
    public static List<Messaging.Singleemailmessage> sendEmail(List<EmailMessageWrapper> listEmailMessageWrapper, String emailTemplateName) {
        List<Messaging.SendEmailResult> listEmailResult = null;

        List<Messaging.Singleemailmessage> listSingleEmailMessages = new List<Messaging.Singleemailmessage>();
        EmailTemplate emailTemplate=[Select Id, BrandTemplateId,Subject, HtmlValue, Body, IsActive from EmailTemplate where developerName=:emailTemplateName
                                                                                 AND IsActive = TRUE]; 
        for (EmailMessageWrapper emailMessageWrapper : listEmailMessageWrapper) {

            Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();

            if(emailMessageWrapper.FromAddress != null && emailMessageWrapper.FromAddress.length() > 0)


            if(emailMessageWrapper.ToAddress != null && emailMessageWrapper.ToAddress.length() > 0)  
                mail.setToAddresses(new String[] { emailMessageWrapper.ToAddress }); 

            if(emailMessageWrapper.BccAddress != null && emailMessageWrapper.BccAddress.length() > 0)

                mail.setBccAddresses(new String[] {emailMessageWrapper.BccAddress });

            String subject = null;
            if(emailMessageWrapper.Subject != null && emailMessageWrapper.Subject.length() > 0) {


                subject = emailMessageWrapper.Subject;

                subject = emailTemplate.Subject;
            for(String key: emailMessageWrapper.ParameterSubjectMap.keySet())

                subject = subject.replace(key, (emailMessageWrapper.ParameterSubjectMap.get(key) == null ? '' : emailMessageWrapper.ParameterSubjectMap.get(key)));
            String htmlBody = emailTemplate.HtmlValue;

            //String plainBody =  emailTemplate.Body;

            for (String key : emailMessageWrapper.ParameterBodyMap.keySet()) {

                htmlBody = htmlBody.replace(key, (emailMessageWrapper.ParameterBodyMap.get(key) == null) ? '' : emailMessageWrapper.ParameterBodyMap.get(key));

                //plainBody = plainBody.replace(key, (emailMessageWrapper.ParameterBodyMap.get(key) == null) ? '' : emailMessageWrapper.ParameterBodyMap.get(key));
           // plainBody = "<html><img border="0" src="https://c.cs16.content.force.com/servlet/servlet.ImageServer?id=015f00000001tbu&oid=00Df0000003bQgv" beditid="r1sp1" blabel="headerImage" id="r1sp1" alt="Header">'+plainBody+'<html>';
           // plainBody = '<html>'+plainBody+'<html>';
            htmlBody = htmlBody.replaceAll('<!\\[CDATA\\[', ''); // replace '<![CDATA['
             htmlBody= htmlBody.replaceAll('\\]\\]>', ''); // replace ']]'
         listEmailResult = Messaging.sendEmail(listSingleEmailMessages);
        return listSingleEmailMessages;
Email templates using letterhead not displayed on the emails recieved through scheduler.  
Only the middle contents is visible in the emails recieved through scheduler.  

But when I send a test email from visualforce page I am able to see the template on the emails recieved.
Its only when the emails are sent through the scheduler the template's header and footer section not visible and only the middle section of the template which contains dynamic contents are visible.
Visualforce page gives unresponsive error while loading records around 2000+.
I added readOnly= true in the apex:Page tag but didn't help.

But still I am getting this error . Please help.
User-added image

Hi All,

I am getting this error while performing 'Run All Tests'. However, individual test classes works fine. This error is also intermittent. I am not sure how to fix this and why I'm getting this error. Can anyone help?

Hi - I have a custom object and I want an update of 75 (score) or higher to Score__c (field in custom object) to update the Lead status on the corresponding lead to "Marketing Qualified Lead". I can only do this via an apex trigger and was hoping that someone here had some sample code for me to be able to make this happen in my instance of SFDC.

Custome Object Name: Infer Entity Score
Custom field name: Infer Score
Standard Object Name: Lead
Standard Field name: Lead Status

Syntax should be something like this:
When custom object infer score is 75 or greater then update lead status to Marketing qualified lead.


I am new to Visual Force and I have what I feel like shouldn't be that difficult of a task.  On the Event object I am trying to create a button that when a user clicks it will create a record on a custom object.  Anyone have any suggestions as to how to get this process off the ground? 

Hello everyone, just wanted to share with the community this custom component I made and give something back for the help I've received. :smileyhappy:

The purpose of the component is to enable autocomplete in lookup fields. I used the autocomplete js created by Jim Roos:
(http://www.jimroos.com/2007/05/ajax-autocomplete.html) but made some modifications to it so that it could interact with an Apex controller among some other things...

So my idea was that if you were making a VF page that had an inputfield that was related to a lookupfield you would just insert this autocomplete component to that inputfield. Something like this:

           <apex:inputField value="{!Contact.accountid}" id="accname" styleClass="cField">
<c:autocomplete ObjectName="Accounts" InputId="{!$Component.accname}" AutoCompleteId="accACid" ClassName="autocomplete300"/>

The component has 4 parameters:

The name of the object or custom object that the inputfield relates to (new objects must be added inside the apex classes since i had some problems constructing a dynamic query).
The InputId which is used to relate the component to the input field
The id for the Component
A classname parameter that basically just defines the width of the suggestions menu.

Here's a screenshot of how it looks like in action:

Here's a link to the file containing the required files:



Message Edited by jonathan rico on 08-16-2008 01:55 PM

Message Edited by jonathan rico on 08-17-2008 09:04 AM
Message Edited by jonathan rico on 01-02-2010 05:01 PM
I see the the Apex Math.round() function is being deprecated in favor of Math.roundToLong().

It looks like we now have to use the following code to convert a number field value from double to integer for use in functions that require integer parms (e.g. Date.newInstance(year,month,day))

Integer intValue = Integer.valueOf(String.valueOf(Math.roundToLong(object.Some_Number_Field__c)));

Are there plans to allow casting or conversion from Long to Integer in Apex?  Or at least, is there an easier way to achieve the same result than the example above?