• PaulATPimptasti
  • NEWBIE
  • 55 Points
  • Member since 2007

  • Chatter
    Feed
  • 2
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 10
    Questions
  • 28
    Replies

Hello,

I'm hoping that someone can shed some light on this for me.  Is there a way to add a custom button that links to a URL to the right of the "New" button in Recent Cases? 

 

I already have a custom button and can add it to Case Layout, the Search Views, and all that but is there anywhere in SalesForce that allows you to edit the Recent Cases View and add a button.

 

To clarify, the Recent Cases View I am talking about is the view that pops up when you click the tab for Cases.

 

Please let me know.

 

Thank you,

Marc Petersen

Dear All,

 

I have been involved in a rather frustrating email exchange with Salesforce support (both partner and 'premier' support) but I simply cannot believe what they are saying is true.

 

We signed up for our first development org in October 2007 where we started to build a managed package to manage our support cases, timesheets and invoicing for our Unlimited Edition instance.  I contacted my Salesforce account manager at the end of March 2011 and asked him to enable Entitlements in our live Unlimited Edition org.  At the same time I contacted Salesforce support and asked them to enable Entitlements in our Developer Edition org so that we could integrate the Entitlements functionality into our managed package.  This was the response I received:

 

 

Developer Edition (DE) orgs created before this feature was made available (164 release, which was after your dev org was created) will not have this feature enabled.  Anyone wanting to use this feature in a DE org, should sign-up for a new DE org on the page below: (link to sign up page)

Huh?  So what Salesforce are saying is that any developer who has an older org (i.e who has been a Salesforce customer for longer) will not get access to any new Salesforce.com functionality.   If a developer wants to get access to the new functionality and ultimately help increase Salesforce.com's revenues they need to create a new package and migrate all of their customers' data from the old objects in to the new objects?  Seems slightly odd and very counter productive!  I can't imagine if likes of BMC / DreamFactory / Vertical Response have Developer Edition instances on NA5 that they would have been given the same response!

 

I decided to contact my account manager to see whether this response was just due to a momentary lapse on the part of the support rep, as I couldn't beleive it was true!  Apparently it is.  Salesforce will not enable new functionality in old developer edition orgs!  If this is true, then it does pose an interesting question.  Are the Developer Edition orgs the same as the live ones?  Surely in the world of SAAS and after a major upgrade by the hosting provider everyone should be on the same version of the 'software'?

 

Has anyone else come across this issue?  If so, how did you fix it?  I know that Salesforce do support behind the scenes migration of development orgs as we have recently had a publishing org migrated from NA7 to NA10, so I know that it can be done, but I do not understand why it hasn't been offered!

 

Please can anyone help?

 

Salesforce, is anyone able to put right what seems like a very simply administrative mistake and get our org moved or updated so we can integrate entitlements into our business processes!

Hello,

 

I've discovered something very strange with Force.com Sites and the Customer Portal.  If you change the owner of a Case to a Customer Portal User this then updates the Case's Contact to the Contact associated with the Customer Portal User.

 

This change happens deep in the background and by passes all of the validation rules and triggers that we have in place to prevent Case Contact's from changing, and Cases being logged with Contacts associated to an Account other than the one the Case is associated with.  However, when you change the Case Owner back to an internal user, the Validation and Triggers are fired and then it recgonises that the Case's Contact is not assoicated with the same Account as the Case and an error is produced.

 

My question is:  Is this correct behaviour or am I missing something obvious with Sharing Rules or such like?

 

Any tips would be greatly appreciated.

 

Kind regards,

 

Paul.

Dear All,

 

I have an odd problem.   I am trying to select a Document based upon its DeveloperName, however when I try to save my class I receive the following error.

 

"Error:Compile Error: No such column 'DeveloperName' on entity 'Document'. Ifyou are attempting to use a custom field, be sure to append the '__c'after the custom field name. Please reference your WSDL or the describecall for the appropriate names"

 

My select statement is:

 

"SELECT Id, Body FROM Document WHERE DeveloperName = 'Oversize_Attachment_Test'"

 

When running the SELECT statement from the IDE Schema Browser a record is returned without error. However when running the same select from an APEX Class I receive the above error.

 

Any ideas?

 

Paul 

Hi all,

 

I have an interesting question.  Has anyone found a way of improving speed of the AJAX requests contained within Visualforce pages?

 

We have built a large number of VF pages and it takes between one a three seconds for the action methods contained within links, buttons and action support tags to complete and to re-render the page.

 

This normally isn't a problem on single row input forms.  However we have started to use multi line input forms for updating and editing large quantities of data.  This means that we have to wait for the action to complete before changing the value in the subsequent fields.

 

Maybe I'm just being impatient as I'm relatively new to AJAX but it seems to me that other AJAX sites I have used respond much quicker. 

 

It would be interesting to hear your thoughts / comments. 

Hi All,

I have a very odd problem.  I am using an <apex:param> in a <apex:commandLink> to send the details of a payment which consists of strings, numbers and a date to a controller to assign to an sObject.  I had wanted to use the <apex:param> to directly assign an sObject on the Visualforce page direct to the Controller but that caused an error. 

All values apart from the date are recieved and are assigned to the sObject in the controller.

Any assistance would be greatly appreciated as I can't find any information on this error anywhere.

Kind regards

Paul

 

Visualforce Code:

<apex:column >
<apex:commandLink value="Create Invoice" action="{!refreshQuickCreateForm}" rerender="myPanel" status="PageStatus" onclick="YAHOO.foration.com.showMe();">
<apex:param name="payAccount" assignTo="{!QuickInvoicePayment.Payment_Account__c}" value="{!pay.Payment_Account__c}"/>
<apex:param name="payAmount" assignTo="{!QuickInvoicePayment.Payment_Amount__c}" value="{!pay.Payment_Amount__c}"/>
<apex:param name="payDescription" assignTo="{!QuickInvoicePayment.Payment_Description__c}" value="{!pay.Payment_Description__c}"/>
<apex:param name="payDate" assignTo="{!QuickInvoicePayment.Payment_Date__c}" value="{!pay.Payment_Date__c}"/>
<apex:param name="payId" assignTo="{!QuickInvoicePayment.for__Related_Invoice__c}" value="{!pay.Related_Invoice__c}"/>
</apex:commandLink>
</apex:column>

 Controller Code:

public for__Invoices__c quickCreateInvoice = new for__Invoices__c();
public for__Invoice_Line_Item__c quickCreateLineItem = new for__Invoice_Line_Item__c();
public for__Payments__c QuickInvoicePayment {get;set;}

public boolean showQuickCreateLineItems = false;

public for__Invoices__c getQuickCreateInvoice()
{
if(QuickInvoicePayment == null)
{
QuickInvoicePayment = new for__Payments__c();
}

system.debug('Payment = ' +QuickInvoicePayment);

if(quickCreateInvoice.for__Account__c != null)
{
Account tmpAcc = [SELECT for__payment_terms__c FROM Account WHERE Id = :quickCreateInvoice.for__Account__c LIMIT 1];
quickCreateInvoice.for__Invoice_Payment_Terms__c = tmpAcc.for__payment_terms__c;
quickCreateInvoice.for__Invoice_Description__c = dateTime.Now().format();
quickCreateInvoice.for__Invoice_Date__c = QuickInvoicePayment.for__Payment_Date__c;

quickCreateLineItem.for__Opportunity__c = null;
quickCreateLineItem.for__Expenditure_Type__c = null;

showQuickCreateLineItems = true;

}
/*
if(QuickInvoicePayment.for__Related_Invoice__c != null && quickCreateInvoice.for__Account__c == null)
{
system.debug('looking up invoice details');

for__Invoices__c tmpInv = [SELECT Id, for__Account__c, for__Account__r.Name, for__Invoice_Payment_Terms__c, for__Invoice_Description__c, for__Invoice_Date__c, for__Invoice_Type__c FROM for__Invoices__c WHERE Id = :QuickInvoicePayment.for__Related_Invoice__c LIMIT 1];
quickCreateInvoice = tmpInv;

showQuickCreateLineItems = true;

}
*/
system.debug(quickCreateInvoice);

quickCreateLineItem.for__Line_Item_Description__c = QuickInvoicePayment.for__Payment_Description__c;
quickCreateLineItem.for__Line_Item_Unit_Price__c = QuickInvoicePayment.for__Payment_Amount__c;
quickCreateLineItem.for__Line_Item_Unit_Sale_Price__c = QuickInvoicePayment.for__Payment_Amount__c;
quickCreateLineItem.for__Line_Item_VAT_PCT__c = 0;

return quickCreateInvoice;
}

I have also made sure that the values are acutally being rendered to the browser, below is a copy of the page source for the command link.

 

YAHOO.foration.com.showMe();;A4J.AJAX.Submit('_viewRoot','j_id0:j_id114',event,{'status':'j_id0:PageStatus','similarityGroupingId':'j_id0:j_id114:UnassignedPayments:j_id145:2:j_id169','parameters':{'payId':'','payDescription':'WEEDEN P H PAYMENT','myTmpVeryTmpUniqueDate':{'date':11,'day':5,'hours':0,'minutes':0,'month':8,'seconds':0,'time':1252627200000,'timezoneOffset':0,'year':109} ,'payDate':{'date':11,'day':5,'hours':0,'minutes':0,'month':8,'seconds':0,'time':1252627200000,'timezoneOffset':0,'year':109} ,'j_id0:j_id114:UnassignedPayments:j_id145:2:j_id169':'j_id0:j_id114:UnassignedPayments:j_id145:2:j_id169'} ,'actionUrl':'https://for.na5.visual.force.com/apex/matchInvoicePayments'} );return false;

As you can see the date is present, however the debug log only show this:

getQuickCreateInvoice: line 172, column 9: Payment = for__Payments__c:{for__Payment_Amount__c=0, for__Payment_Account__c=, for__Payment_Description__c=, for__Related_Invoice__c=}

Any help would be greatly appreciated.

 

 

 

Message Edited by PaulATPimptasti on 09-17-2009 07:11 AM
Message Edited by PaulATPimptasti on 09-17-2009 07:12 AM

I have a strange one here.  I am looping through the same object twice within a method.  The first time I iterate through the object it works, yet the second time I get a null pointer exception error.

 

 

//sum the case time global Case[] CalculateCaseTime(Case[] cases, for__Timesheet__c[] caseTimesheets) { try { if(cases.size() > 0 && caseTimesheets.size() >0) { //this zeros the Case's billable hours so as to prevent the values present on the Case //from being summed as this will create incorrect quantities. for(Case currentCase:cases) { for(for__Timesheet__c caseTimesheet:caseTimesheets) { caseTimesheet.for__Case__r.for__Billable_Hours__c = 0; system.debug(' - Zeoring Timesheet\'s Case Billable Hours = ' + caseTimesheet.for__Case__r.for__Billable_Hours__c); } } system.debug(cases); for(Case currentCase:cases) { system.debug('Calculating the total amount of time spent on Case ' + currentCase.Id); currentCase.for__Hours_Worked__c = 0; system.debug(' - Zeroing Case\'s Hours Worked = ' + currentCase.for__Hours_Worked__c); currentCase.for__Billable_Hours__c = 0; system.debug(' - Zeroing Case\'s Billable Hours Worked = ' + currentCase.for__Billable_Hours__c); for(for__Timesheet__c caseTimesheet:caseTimesheets) { if(currentCase.Id == caseTimesheet.for__Case__c) { currentCase.for__Hours_Worked__c += caseTimesheet.for__Activity_Duration__c; currentCase.for__Billable_Hours__c += caseTimesheet.for__Total_Billable_Hours__c; caseTimesheet.for__Case__r.for__Billable_Hours__c += caseTimesheet.for__Total_Billable_Hours__c; system.debug(' - Timesheet\'s Case Billable Hours = ' + caseTimesheet.for__Case__r.for__Billable_Hours__c); } } } } return cases; } catch(exception excpt) { system.debug('CalculateCaseTime exception = ' +excpt); f.debug('CalculateCaseTime exception Cause = ' + excpt.getCause()); f.debug('CalculateCaseTime exception Message = ' + excpt.getMessage()); f.debug('CalculateCaseTime exception Name = ' + excpt.getTypeName()); processedOK = false; return null; } }

 

 When the cases has one record I am able to get here:

 

caseTimesheet.for__Case__r.for__Billable_Hours__c = 0; system.debug(' - Zeoring Timesheet\'s Case Billable Hours = ' + caseTimesheet.for__Case__r.for__Billable_Hours__c);

 Yet when it tries to execute this:

 

 

system.debug(cases);

  Or loop through the cases variable for a second time I get this error:

 

 

CalculateCaseTime exception = System.NullPointerException: Attempt to de-reference a null object

 Please help as it has only stopped working recently and I haven't change that code so I suspect it could be an issue with Sf.com but not 100% sure

 

 

 

 

 

 

 

Here's an interesting one.

 

Is there an API / Method / widget that we can use to search telephone numbers via Apex is a similar way to that of the CTI.

 

The issue we have is that numbers are stored in Salesforce using all sorts of formats including brackets, +, 00<country_code> and we don't really want to have to edit all of these numbers but that is certainly plan B.

 

The CTI softphone does a clever look up as it takes the inbound number in the format 02071234567 and then looks up the Contact with the corresponding number.  However in our instance that number is stored +44 20 7123 4567due to the Outlook Sync.  As Salesforce does not store the Country Code or Area Code in separate fields it means that the CTI must be doing some processing.

 

If anyone has come across this or has any ideas it would be great to hear from you!

 

Cheers

 

Paul

Hi all... not the usual place to post this, but thought it might be of interest to you APEX experts!!!

I am our Sf.com admin and I need a couple of APEX classes built to process xml / text attachments using the email services for Salesforce as well as create some APEX code to bulk update and merge records across objects!

Fun little project for those with some spare time and wanting to earn some more $$ or ££

We're based in the UK, but am happy to work with people not in UK.

Work needs to be completed within the next few weeks so please send me a message with availability, expertiese, demo of work, and rates.

Hope to hear from you soon!!

Paul

Hi

I am our Sf.com admin and I need a couple of APEX classes built to process xml / text attachments using the email services for Salesforce as well as create some APEX code to bulk update and merge records across objects!

Fun little project for those with some spare time and wanting to earn some more $$ or ££

We're based in the UK, but am happy to work with people not in UK.

Work needs to be completed within the next few weeks so please send me a message with availability, expertiese, demo of work, and rates.

Cheers

Paul
Hi

I've been trying to build a custom button that will allow me to pre-populate the edit mode of a new transaction with the values from two objects.

ie. to issue refunds we need to pull in financial information from the transaction that created the asset, and also pass in the information of the asset so we can create a relationship between the refund record, the asset and the original transaction.

The code below works if you hardcode the Asset.Id value and call it from the AJAX ToolKit, but if I use the code behind a Custom Detail Page button, I get a blank screen.

Any help would be great as I'm well and truely stuck!!

Thanks

Paul

<html>
<head>
<script src="/soap/ajax/10.0/connection.js"></script>
<script type="text/javascript">
function init()
{
//look purchase information
var QueryString = "SELECT BillingContactRecord__c , ProductSinglePrice__c, Quantity__c, Discount__c, VatPct__c FROM Transaction_Log__c WHERE Id = '" + {!Asset.Purchase_RecordId__c} + "'";

// Issue the SOQL query using the AJAX Toolkit.
var QueryResults = sforce.connection.query(QueryString);
var m = document.getElementById('main');
var QueryRecords = QueryResults.getArray("records");
// Write out the results.

// IF the VAT ID lookup fails, then search on Name, PostalCode and BillingStreet (1st line of address)
for (var i=0; i<QueryRecords.length; i++){
var QueryRecord = QueryRecords[i];
var BillingContactRecord__c = QueryRecord.BillingContactRecord__c;
var ProductSinglePrice__c = QueryRecord.ProductSinglePrice__c;
var Quantity__c = QueryRecord.Quantity__c;
var Discount__c = QueryRecord.Discount__c;
var VatPct__c = QueryRecord.VatPct__c;
}

var newUrl = "/a08/e?retURL=%2F" + purchaseRecordID +
"&RecordType=01220000000D0iC&CF00N200000017Hkw_lkid=" + BillingContactRecord__c +
"&CF00N200000017Hkw=" + getContactInfo(BillingContactRecord__c) +
"&00N200000017Eo9=" + ProductSinglePrice__c +
"&00N200000017EoS=" + Quantity__c +
"&00N200000017Ep1=" + Discount__c +
"&00N200000017Eow=" + VatPct__c +
"&CF00N200000017kz6=" + {!Asset.Name}
"&CF00N200000017kz6_lkid=" + {!Asset.Id};
m.innerHTML += newUrl ;
window.parent.location.replace(newUrl);
}
function getContactInfo(contactID)
{
//look purchase information
var QueryString = "SELECT FirstName, LastName FROM Contact WHERE Id = '" + contactID + "'";

// Issue the SOQL query using the AJAX Toolkit.
var QueryResults = sforce.connection.query(QueryString);
var QueryRecords = QueryResults.getArray("records");
// Write out the results.

// IF the VAT ID lookup fails, then search on Name, PostalCode and BillingStreet (1st line of address)
for (var i=0; i<QueryRecords.length; i++){
var QueryRecord = QueryRecords[i];
var FullName = QueryRecord.FirstName + " " + QueryRecord.LastName
return FullName
}
}
</script>
</head>
<body onload="init()">
<div id="main"></div>
</body>
</html>

Hello,

 

I've discovered something very strange with Force.com Sites and the Customer Portal.  If you change the owner of a Case to a Customer Portal User this then updates the Case's Contact to the Contact associated with the Customer Portal User.

 

This change happens deep in the background and by passes all of the validation rules and triggers that we have in place to prevent Case Contact's from changing, and Cases being logged with Contacts associated to an Account other than the one the Case is associated with.  However, when you change the Case Owner back to an internal user, the Validation and Triggers are fired and then it recgonises that the Case's Contact is not assoicated with the same Account as the Case and an error is produced.

 

My question is:  Is this correct behaviour or am I missing something obvious with Sharing Rules or such like?

 

Any tips would be greatly appreciated.

 

Kind regards,

 

Paul.

I need to add a filter to the following code to mitigate the following error.   Collection size 2,208 exceeds maximum size of 1,000

 

How do I add a filter to limit the SOQL call.

 

I am not a developer and do not have one to work on this issue as of yet,  I have posted my code for this class and I need to be able to use all of the records, but do not know where to make the change to get past the 1000 limit.  Any help would be appreciated.

 

 

 

 

 

 


//================================================​======================
// Package: Opinion Leader Engagement System (OLES​)
//  Object: olesHomeController
// Company: The Coca-Cola Company
// Authors: John Westenhaver (Capgemini)& Ajaykuma​r Varakala (Capgemini)
// Comment: VF controller for home page. Implement​s search. It is a bit
//          strange in that the search query pulls​ in two different
//          queries and merges the lists into a th​ird query because
//          SF doesn't really support SQL. This pa​ge does NOT have a
//          sort feature (thankfully).
//================================================​======================
//          Date       Purpose
// Changes: 07/10/2010 Original version
//================================================​======================

public with sharing class olesHomeController
{
  public olesHomeController(ApexPages.StandardCont​roller controller) { }
  public olesHomeController(ApexPages.StandardSetC​ontroller controller) { }

  private List<Contact> cList;
  private List<Contact> cListOwner;
  private List<Contact> cListFollower;
  private String searchText;
  Boolean hasSearched = false;

  // Define the base SQL for this page.
  // This page is a bit curious in that 
  public String sqlBase = 'SELECT Id, Name, LastNa​me, FirstName, AccountId, Account.Name, Title, Loc​ation__c, Email, Phone, KeyFocusArea__c, Geographi​c_KO_Group__c, Sector__c, Geographic_Market__c, Pi​cture__c FROM Contact ';
  public String whereClause = ' ';
  public String whereClauseOwner = ' WHERE (OwnerI​d = ' + '\'' + userInfo.getUserId() + '\') ';
  public String whereClauseFollower = ' WHERE (Own​erId = ' + '\'' + userInfo.getUserId() + '\') ';
  public String currentSql = sqlBase + whereClause​ + ' ORDER BY LastName, FirstName';
  public String currentSqlOwner = sqlBase + whereC​lauseOwner;
  public String currentSqlFollower = sqlBase + whe​reClauseFollower;
  String cId = userInfo.getUserId();

  private void showSql(String sql)
  {
    ApexPages.Message msg = new ApexPages.Message(​ApexPages.Severity.INFO, sql);
    ApexPages.AddMessage(msg);
  }

  // Execute the dynamic query.
  public List<Contact> getContacts()
  {
    List<ID> cIds = new List<ID>();
    String idString = ' ';
    try
    {
      if ((cList == null) || (hasSearched))
      {
        // Get a list of contacts owned by the cur​rent user.
        cListOwner = Database.query(currentSqlOwne​r);

        // Get a list of contacts the current user​ is following.
        cListFollower = Database.query(currentSqlF​ollower);
                
               // Get lists of IDs from these quer​ies.
        IF (cListOwner.size() > 0)
        {
          for (Contact c : cListOwner)
          {
            cIds.add(c.Id);
          }
        }
        IF (cListFollower.size() > 0)
        {
          for (Contact c : cListFollower)
          {
            cIds.add(c.Id);
          }
        }

        // Make a string out of these contact IDs.
        // Fortunately, any duplicates will be dro​pped automatically when we re-query this list.
        if (cIds.size() > 0)
        {
          for (String id : cIds)
          {
            idString += '\'' + id + '\', ';
          }
          idString = idString.substring(0, (idStri​ng.Length() - 2));
          whereClause = ' WHERE Id IN (' + idStrin​g + ') ';
        }

        // Assemble the final query string.
        currentSql = sqlBase + whereClause + ' ORD​ER BY LastName, FirstName ';

        // Get a list of these contacts in the cor​rect order.
        cList = Database.query(currentSql);

        hasSearched = (cList.size() == 0);
      }
      return cList;
    }
    catch (QueryException qe)
    {
      apexPages.addMessages(qe);
      return null;
    }
  }
   
  
  // Return the current search string.
  public String getSearchText()
  {
    return searchText;
  }
  
  // Set the current search string.
  public void setSearchText(String searchText)
  {
    this.searchText = searchText;
  }

  // Assemble a new query string.
   public PageReference search() 
  {
    String userId = UserInfo.getUserId();
    String qt = searchText + '%';

    // Assemble owner where clause.
    // Note the location has wildcards on both sid​es.
 //  whereClauseOwner  = ' WHERE (OwnerId = ' + '\​'' + userId + '\')' + ' AND ((FirstName LIKE ' + '​\'' + qt + '\') ';
    whereClauseOwner = 'WHERE ((FirstName LIKE ' +​ '\'' + qt + '\') ';
    whereClauseOwner += ' OR (LastName LIKE ' + '\​'' + qt + '\') ';
    whereClauseOwner += ' OR (Account.Name LIKE ' ​+ '\'' + qt + '\') ';
    whereClauseOwner += ' OR (Title LIKE ' + '\'' ​+ qt + '\') ';
    whereClauseOwner += ' OR (Location__c LIKE ' +​ '\'%' + qt + '\') ';
//    whereClauseOwner += ' OR (KeyFocusAreas__c L​IKE ' + '\'' + qt + '\') ';
    whereClauseOwner += ' OR (Geographic_KO_Group_​_c LIKE ' + '\'' + qt + '\') ';
    whereClauseOwner += ' OR (Sector__c LIKE ' + '​\'' + qt + '\') ';
    whereClauseOwner += ' OR (Geographic_Market__c​ LIKE ' + '\'' + qt + '\') ';
    whereClauseOwner += ' ) ';

   // Assemble follower where clause.
//    whereClauseFollower = ' WHERE (Id IN (SELECT​ au.Associated_Users__c FROM Associated_Users__c a​u WHERE au.Associated_KO__c = ' + '\'' + userId + ​'\')) ';
    whereClauseFollower = ' WHERE ((FirstName LIKE​ ' + '\'' + qt + '\') ';
    whereClauseFollower += ' OR (LastName LIKE ' +​ '\'' + qt + '\') ';
    whereClauseFollower += ' OR (Account.Name LIKE​ ' + '\'' + qt + '\') ';
    whereClauseFollower += ' OR (Title LIKE ' + '\​'' + qt + '\') ';
    whereClauseFollower += ' OR (Location__c LIKE ​' + '\'%' + qt + '\') ';
//    whereClauseFollower += ' OR (KeyFocusAreas__​c LIKE ' + '\'' + qt + '\') ';
    whereClauseFollower += ' OR (Geographic_KO_Gro​up__c LIKE ' + '\'' + qt + '\') ';
    whereClauseFollower += ' OR (Sector__c LIKE ' ​+ '\'' + qt + '\') ';
    whereClauseFollower += ' OR (Geographic_Market​__c LIKE ' + '\'' + qt + '\') ';
    whereClauseFollower += ' ) ';

    // Assemble query strings.
    currentSqlOwner = sqlBase + ' ' + whereClauseO​wner + ' ORDER BY LastName, FirstName ';
    currentSqlFollower = sqlBase + ' ' + whereClau​seFollower + ' ORDER BY LastName, FirstName ';

    // Force re-query.
    cList = null;
    cListOwner = null;
    cListFollower = null;
    hasSearched = true;
    return null;
  }
 
/*
apexpages.message msg = new apexpages.message(apex​pages.severity.INFO,currentSql);
apexpages.addmessage(msg);
*/
 static testMethod void testHomeController(){
 List<Contact> conList = [Select Name From Contact​ Where OwnerId=:Userinfo.getUserId()];
 olesHomeController HomeController = new olesHomeC​ontroller(new ApexPages.StandardSetController(conL​ist));

 HomeController.getContacts();

 HomeController.searchText = 'TestSearchText';
// HomeController.search();
 PageReference result = HomeController.search();
 Boolean b;
  HomeController.hasSearched = true;
  b = HomeController.hasSearched;
  system.assertEquals(b,true);

 }

  • March 10, 2011
  • Like
  • 0

On a VF page, I have a pageBlockTable.  There are times where there are more than 1000 records in the collection to be rendered.  When this occurs, the Visualforce collection limit of 1000 is hit and the page doesn't load.  I need to figure out a creative solution for getting around this.  In the end...

 

  1. I need all records to render on the page. If I do any pagination, it'll happen client-side after the records are loaded in the HTML.  I know the first responses to this will be about whether I really need to have all those records on the page and how there is doubt about whether I need to, but for the purposes of this forum post, please work with me here.
  2. I want to keep the look and feel of a pageBlockTable if possible.

 

When not using pageBlockTables, I have used a construct similar to the following to get through a collection of more than 1000 items.

 

<apex:repeat value="{!myCollection}" var="item" rows="1000" first="0">
{!item.text}
</apex:repeat>
<apex:repeat value="{!myCollection}" var="item" rows="1000" first="1000">
{!item.text}
</apex:repeat>
<apex:repeat value="{!myCollection}" var="item" rows="1000" first="2000">
{!item.text}
</apex:repeat>

 

pageBlockTable has the rows and first parameters, but if I do that, I'd be getting a new pageBlockTable everytime.

 

The options I can think of are:

 

  • Get a creative solution from the forums to actually utilize the pageBlockTable (purpose of this post)
  • Use apex:dataTable and try to use style classes to mimix the pageBlockTable look and feel. This is a nice possibility I haven't tried yet.
  • Use apex:repeat tags and make up my own HTML styling

 

Any help is appreciated.

 

 

  • September 13, 2010
  • Like
  • 0

Hi How do I get around this error message...

Collection size 1,609 exceeds maximum size of 1,000.

 

 

public String cname{get; set;} public List<SelectOption> getnames() { List<SelectOption> options = new List<SelectOption>(); List<Contact> namelist = new List<Contact>(); namelist = [Select Id, Name FROM Contact where Recordtype.name='Company' Order by LastName,FirstName]; options.add(new SelectOption('--None--','--None--')); for (Integer j=0;j<namelist.size();j++) { options.add(new SelectOption(namelist[j].Name,namelist[j].Name)); } return options; }

 

 

<td> <apex:outputlabel value="Company Names" for="cnamed" /> <apex:selectList value="{!cname}" size="1" id="cnamed"> <apex:actionSupport event="onchange" reRender="newvalue" /> <apex:selectOptions value="{!names}"/> </apex:selectList> </td>

 Thank you

 

 

I am experiancing something very strange.  I created a batch apex class, part of the query returns a custom field (Nurturing_Grade_Points__c , Formula Number field This formula references multiple objects) and the sobjects in the execute method all have that custom field set to 0.00.  Even though I know for a fact none of them are equal to zero.

 

My query is: 

Select c.Nurturing_Grade_Points__c, c.Id From CampaignMember c Where c.HasResponded = True and c.Nurturing_Grade_Points__c > 0 and c.FirstRespondedDate > 2008/1/1 and ContactID != NULL Order By c.ContactId

 

Using system.debug  in the execute method i am printing out each CampaignMember.  All of them have have Nurturing_Grade_Points__c equal to 0.00.  Example:

 

CampaignMember:{Nurturing_Grade_Points__c=0.00, Id=XXXXXXX}

 

If I go look at that capaign member I can clearly see that the Nurturing_Grade_Points__c field is set to a number higher than zero.  Something seems to be happening between the query and execute methods where my custom field is getting set to zero.  This is driving me batty anyone have any ideas why this is happening? Can you not use custom formula fields in batch apex?

Dear All,

 

I have an odd problem.   I am trying to select a Document based upon its DeveloperName, however when I try to save my class I receive the following error.

 

"Error:Compile Error: No such column 'DeveloperName' on entity 'Document'. Ifyou are attempting to use a custom field, be sure to append the '__c'after the custom field name. Please reference your WSDL or the describecall for the appropriate names"

 

My select statement is:

 

"SELECT Id, Body FROM Document WHERE DeveloperName = 'Oversize_Attachment_Test'"

 

When running the SELECT statement from the IDE Schema Browser a record is returned without error. However when running the same select from an APEX Class I receive the above error.

 

Any ideas?

 

Paul 

Hi all,

 

I have an interesting question.  Has anyone found a way of improving speed of the AJAX requests contained within Visualforce pages?

 

We have built a large number of VF pages and it takes between one a three seconds for the action methods contained within links, buttons and action support tags to complete and to re-render the page.

 

This normally isn't a problem on single row input forms.  However we have started to use multi line input forms for updating and editing large quantities of data.  This means that we have to wait for the action to complete before changing the value in the subsequent fields.

 

Maybe I'm just being impatient as I'm relatively new to AJAX but it seems to me that other AJAX sites I have used respond much quicker. 

 

It would be interesting to hear your thoughts / comments. 

Hello,

I'm hoping that someone can shed some light on this for me.  Is there a way to add a custom button that links to a URL to the right of the "New" button in Recent Cases? 

 

I already have a custom button and can add it to Case Layout, the Search Views, and all that but is there anywhere in SalesForce that allows you to edit the Recent Cases View and add a button.

 

To clarify, the Recent Cases View I am talking about is the view that pops up when you click the tab for Cases.

 

Please let me know.

 

Thank you,

Marc Petersen

Hi,

 

I have pdf document attached with Notes and attachment in a specific object. Is there a way to export those pdf documnet to external server. I cannot send those documnet attached in a mail because of security reason. Please advice if there is a way to export the pdf documnets without email attachment.

  • September 18, 2009
  • Like
  • 0

Hi All,

I have a very odd problem.  I am using an <apex:param> in a <apex:commandLink> to send the details of a payment which consists of strings, numbers and a date to a controller to assign to an sObject.  I had wanted to use the <apex:param> to directly assign an sObject on the Visualforce page direct to the Controller but that caused an error. 

All values apart from the date are recieved and are assigned to the sObject in the controller.

Any assistance would be greatly appreciated as I can't find any information on this error anywhere.

Kind regards

Paul

 

Visualforce Code:

<apex:column >
<apex:commandLink value="Create Invoice" action="{!refreshQuickCreateForm}" rerender="myPanel" status="PageStatus" onclick="YAHOO.foration.com.showMe();">
<apex:param name="payAccount" assignTo="{!QuickInvoicePayment.Payment_Account__c}" value="{!pay.Payment_Account__c}"/>
<apex:param name="payAmount" assignTo="{!QuickInvoicePayment.Payment_Amount__c}" value="{!pay.Payment_Amount__c}"/>
<apex:param name="payDescription" assignTo="{!QuickInvoicePayment.Payment_Description__c}" value="{!pay.Payment_Description__c}"/>
<apex:param name="payDate" assignTo="{!QuickInvoicePayment.Payment_Date__c}" value="{!pay.Payment_Date__c}"/>
<apex:param name="payId" assignTo="{!QuickInvoicePayment.for__Related_Invoice__c}" value="{!pay.Related_Invoice__c}"/>
</apex:commandLink>
</apex:column>

 Controller Code:

public for__Invoices__c quickCreateInvoice = new for__Invoices__c();
public for__Invoice_Line_Item__c quickCreateLineItem = new for__Invoice_Line_Item__c();
public for__Payments__c QuickInvoicePayment {get;set;}

public boolean showQuickCreateLineItems = false;

public for__Invoices__c getQuickCreateInvoice()
{
if(QuickInvoicePayment == null)
{
QuickInvoicePayment = new for__Payments__c();
}

system.debug('Payment = ' +QuickInvoicePayment);

if(quickCreateInvoice.for__Account__c != null)
{
Account tmpAcc = [SELECT for__payment_terms__c FROM Account WHERE Id = :quickCreateInvoice.for__Account__c LIMIT 1];
quickCreateInvoice.for__Invoice_Payment_Terms__c = tmpAcc.for__payment_terms__c;
quickCreateInvoice.for__Invoice_Description__c = dateTime.Now().format();
quickCreateInvoice.for__Invoice_Date__c = QuickInvoicePayment.for__Payment_Date__c;

quickCreateLineItem.for__Opportunity__c = null;
quickCreateLineItem.for__Expenditure_Type__c = null;

showQuickCreateLineItems = true;

}
/*
if(QuickInvoicePayment.for__Related_Invoice__c != null && quickCreateInvoice.for__Account__c == null)
{
system.debug('looking up invoice details');

for__Invoices__c tmpInv = [SELECT Id, for__Account__c, for__Account__r.Name, for__Invoice_Payment_Terms__c, for__Invoice_Description__c, for__Invoice_Date__c, for__Invoice_Type__c FROM for__Invoices__c WHERE Id = :QuickInvoicePayment.for__Related_Invoice__c LIMIT 1];
quickCreateInvoice = tmpInv;

showQuickCreateLineItems = true;

}
*/
system.debug(quickCreateInvoice);

quickCreateLineItem.for__Line_Item_Description__c = QuickInvoicePayment.for__Payment_Description__c;
quickCreateLineItem.for__Line_Item_Unit_Price__c = QuickInvoicePayment.for__Payment_Amount__c;
quickCreateLineItem.for__Line_Item_Unit_Sale_Price__c = QuickInvoicePayment.for__Payment_Amount__c;
quickCreateLineItem.for__Line_Item_VAT_PCT__c = 0;

return quickCreateInvoice;
}

I have also made sure that the values are acutally being rendered to the browser, below is a copy of the page source for the command link.

 

YAHOO.foration.com.showMe();;A4J.AJAX.Submit('_viewRoot','j_id0:j_id114',event,{'status':'j_id0:PageStatus','similarityGroupingId':'j_id0:j_id114:UnassignedPayments:j_id145:2:j_id169','parameters':{'payId':'','payDescription':'WEEDEN P H PAYMENT','myTmpVeryTmpUniqueDate':{'date':11,'day':5,'hours':0,'minutes':0,'month':8,'seconds':0,'time':1252627200000,'timezoneOffset':0,'year':109} ,'payDate':{'date':11,'day':5,'hours':0,'minutes':0,'month':8,'seconds':0,'time':1252627200000,'timezoneOffset':0,'year':109} ,'j_id0:j_id114:UnassignedPayments:j_id145:2:j_id169':'j_id0:j_id114:UnassignedPayments:j_id145:2:j_id169'} ,'actionUrl':'https://for.na5.visual.force.com/apex/matchInvoicePayments'} );return false;

As you can see the date is present, however the debug log only show this:

getQuickCreateInvoice: line 172, column 9: Payment = for__Payments__c:{for__Payment_Amount__c=0, for__Payment_Account__c=, for__Payment_Description__c=, for__Related_Invoice__c=}

Any help would be greatly appreciated.

 

 

 

Message Edited by PaulATPimptasti on 09-17-2009 07:11 AM
Message Edited by PaulATPimptasti on 09-17-2009 07:12 AM
I can access both Holidays and Business Hours, but I'm wondering where to find the junction table between the two.  I'm writing code where I'd like to access only the Holidays that are associated with the Business Hours marked as default and I'm not seeing it.  Any help would be appreciated.
Hi there. I have the following code that leverages a custom object called "Test__c", that has
1 field, which is a lookup to Accounts.

Code:
<apex:page standardController="Test__c" tabStyle="Test__c">
    <apex:sectionHeader title="{!$ObjectType.Test__c.label} Edit" subtitle="New Test"/>
    <apex:form>
    <apex:pageBlock title="Test">
        <apex:pageBlockButtons>
            <apex:commandButton value="Save" action="{!save}" />
            <apex:commandButton value="Cancel" action="{!cancel}" />
        </apex:pageBlockButtons>
    <apex:actionRegion>
        <apex:pageBlockSection title="Information">
            <apex:inputField value="{!Test__c.Account__c}">
                <apex:actionSupport event="onselect" rerender="otherPanel" />
            </apex:inputField>
        </apex:pageBlockSection> 
    </apex:actionRegion>  
    
    <apex:pageBlockSection title="test" id="otherPanel" rendered="true">
        <apex:outputField value="{!Test__c.Account__c}" />
    </apex:pageBlockSection>
    </apex:pageBlock>
    </apex:form>
</apex:page>

Now, when I type a value into the lookup box and I select a value from the autocomplete, the value in the "test" pageBlockSection will update in an Ajax fashion like so:
 

But when I use the lookup dialog to select an account, the field will not update:


Any ideas??
Thanks
  • December 10, 2008
  • Like
  • 1
Hi,

I have a very odd problem indeed.  I am trying to build a nested Map of Contact details.  I need to loop through each Contact record, create a map with the values, Email, AccountId and ContactId and then add this to another map with a integer key.  All pretty straight forward, yet when I try and access the parent map and display the child entries I get the message 'Already Output' and when I loop through the Parent Map object values are all the same, yet when outputting the items in the map after insertion they show the expected values.

The reason I need to use a Map as opposed to a SELECT clause is that we already hold the items in memory and we're trying to limit the number of queries as we're at 11 already.

Code below:
Code:
 private static testMethod void testManualConvertLead()
 {
  Account[] createAccount = new Account[]
   {
    new Account(Name = 'TestLead1'),
    new Account(Name = 'TestLead1'),
    new Account(Name = 'TestLead1')
   };
   
  insert createAccount;

  Contact[] createContact = new Contact[]
   {
    new Contact(FirstName = 'Test', LastName = 'Last 1', Email = 'test1@bob.com', AccountId = createAccount[0].Id),
    new Contact(FirstName = 'Test', LastName = 'Last 2', Email = 'test2@bob.com', AccountId = createAccount[1].Id),
    new Contact(FirstName = 'Test', LastName = 'Last 3', Email = 'test3@bob.com', AccountId = createAccount[2].Id)
   };
   
  insert createContact; 

  Map<Integer,Map<String,String>> contactDetails = new Map<Integer,Map<String,String>>();
  Map<String,String> contactDetail = new Map<String,String>();
  system.debug(createContact.size()); 
  for(integer n = 0; n < createContact.size() ; n++)
  {
   system.debug('-');
   system.debug(createContact[n].Id);
   system.debug(createContact[n].AccountId);
   system.debug(createContact[n].Email);
   
   contactDetail.put('ContactId',createContact[n].Id);
   contactDetail.put('AccountId',createContact[n].AccountId);
   contactDetail.put('Email',createContact[n].Email);
   
   system.debug(contactDetail);   
   system.debug(n);
   
   contactDetails.put(n,contactDetail);
   system.debug(contactDetails.get(n));
   system.debug('-');
  }
  
  system.debug(contactDetails);
  
  for(integer p = 0 ; p < contactDetails.size() ; p++)
  {
   system.debug(contactDetails.get(p));
  }
 }

 

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:

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

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:

AutoCompleteComponent



Jonathan.


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