• icemft1976
  • NEWBIE
  • 70 Points
  • Member since 2007

  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 25
    Questions
  • 40
    Replies

Hi,

 

I have a page that queries a list of accounts using a run time query ( i.e database.query(runtimestring); ) , this query contains a few subqueries as well as the LIKE operator on a text field.   It is calling up a list of accounts depending on the Client Services advisor Id passed in as well as any number of possible Company Division abbreviations (the page is part of a larger app that lets client services view their client book and filter acording to products their clients buy).

 

No matter if the page loads with a query that returns 2 results or 3000 (based on the passed in URL parameters) it takes upwards of 1 minute to load the first time its visited.  From there on out, the load time is about 5 seconds. 

 

The Developer Console timeline puts the delay squarely on the DB query. I'm wondering if there is a situation where the system is generating a sort of "view" on the iniital query construction at run time...and then its using the optimized view on subsequent queries?  I'm not sure i can rewrite the logic to make it a compiled query but I'm willing to try.

 

Again, regardless of the number of records returned or the post prcoessing that needs to happen based onthe returned records count and details.I'm looking for insight on known issues that might be contributing to this behavior. 

 

 I've seen a few people with similar issues but I'd like to sytstematically test this to identify the culprit. I'm as sure I can be its not an asset or Js or rights issue.

 

Thanks for your time.

AJ

 

 EDIT:  Ful disclaimner: the page I'm working on is being fetched by jquery ajax  call and the returned HTML is being inserted into a different main "dashboard" page. But I can recreate the DB delay issue by going directly to the page in question.

 

 

I know there are JavaScript ways to try to replicate a user clicking a dashboard refresh everytime the home page loads) - but I wanted to know if the API exposes the ability to call a refresh directly against a known dashboard Id.

 

I know I  could schedule a job via the API  every 8 hours - so the missing piece is the Dashboard object/method access. 

 

Am I right in thinking it's not exposed?

 

Why?  We have about 7 Dashboard components on a home page and I don't want users to open SF everytime only to have to sit waiting while  everything spins. At that point they probably will navigate away before it ever completes (users' tolerance for delays decreases dramatically if its tied to a common repetitive action...no matter how valuable the updated data they are waiting on)

 

thanks for any information you can provide.

 

ps - yes, I would rather ALL our staff just be trained to refresh it themselves...but of all the adoption and training efforts we have, this is probably the lowest priority and would make a useful solution that was not a hack. It's merely extending the scheduling ability we already have (like how we can schedule multiple Apex runs via the API but not the UI).

I am working on a project that has a very large Visualforce page.  I'm breaking it down into more manageable chunks by using a "State" object that encapsulates information about a particuar state inside of smaller objects.  The base class is abstract, and each state extends that abstract class to provide different functionality.  Anyhow, one state manages a purchase order and has a method called getPO ().  I can access that method via an Apex expression like this:

 

{!curState['PO'].PO_Number__c}

 

In that object (which works perfectly).  Obviously I cannot access the getPO() method directly because the base class does not have that method and the Controller that maintains the state object returns the abstract State obejct, I also have a method called getLineItems() that returns a collection of objects (line items on a purchase order).  The collection is a "List."  I can actually test this such as:

 

<apex:outputText value="{!curState['LineItems']}"/>

 

Which shows the collection as having the correct number of elements.

 

When I attempt to iterate over that collection in a pageBlockTable such as:

 

<apex:pageBlockTable id="lineItems" value="{!curState['LineItems']}" var="t">


it will not compile.  The error message is:

    Save error: Cannot coerce from class core.apexpages.el.adapters.RuntimeTypeMetadataELAdapter to class java.lang.Boolean

 

Perhaps I'm misunderstanding what Datatable should take in the value.  However, if I put the exact same list in the controller class, it WORKS.  Any ideas on how I can fix this?

 

Thanks in advance.

 

I'm brand new to Apex and I'm having some trouble displaying aggregate results in a visualforce page. The extension isn't throwing any errors but the visualforce says "Error: Invalid field cv__Opportunity__c for SObject AggregateResult".

 

The way I read this is, either I'm not calling the fields properly in the visualforce page, or I'm not presenting the aggregate properly in the extension. Any help is of course greatly appreciated!

 

Here's the extension:

public class AccountDesignationHistoryExtension {
    
    Account CurrentAccount = null;
    List<AggregateResult> AccountDesignationHistory = null;
    
    public AccountDesignationHistoryExtension(ApexPages.StandardController controller) {
        CurrentAccount = (Account)controller.getRecord();
        AccountDesignationHistory = [SELECT COUNT(cv__Opportunity__c), Designation_Name__c, SUM(cv__Amount__c), MAX(Close_Date__c)
        From cv__Donation_Designation_Relationship__c
        WHERE cv__Opportunity__r.AccountId = :CurrentAccount.Id
        AND cv__Opportunity__r.StageName = 'Received'
        AND cv__Opportunity__r.cv__Posted__c = False
        GROUP BY Designation_Name__c];
    }
    
    public List<AggregateResult> getAccountDesignationHistory() { return AccountDesignationHistory; }
    
}

Here's the visualforce:

<apex:page standardController="Account" extensions="AccountDesignationHistoryExtension">
    <apex:pageBlock >
        <apex:pageBlockTable value="{!AccountDesignationHistory}" var="a">
            <apex:column value="{!a.cv__Opportunity__c}" headerValue="Number of Donations" />
            <apex:column value="{!a.Designation_Name__c}" headerValue="Designation Name" />
            <apex:column value="{!a.cv__Amount__c}" headerValue="Total Designated Amount" />
            <apex:column value="{!a.Close_Date__c}" headerValue="Most Recent Donation" />
        </apex:pageBlockTable>
    </apex:pageBlock>
</apex:page>

 

I have a query string that I am passing to a Batch Apex method.  I want to include a Set's values in the where clause of the string.  How do I include the set in the string so that it will be parsed correctly?  The example below results in an "unexpected token error" in the debug log when the batch executes.

 

Set<Id> oppIDs = new Set<Id>{id1, id2, id3. etc etc};
CalYearEndBatch cyBatch = new CalYearEndBatch();
cyBatch.query = 'select Role, Opportunity.Amount from OpportunityContactRole where Opportunity__c in:\'' + oppIDs + '\'';
Id batchprocessID = Database.executeBatch(cyBatch);

 

 

In my apex:pageMessages section, if an error message (from a Validation Rule) is displayed, it changes the quotes to their HTML entity, i.e. instead of ", it displays as &quot;

 

Is there a way to prevent this from happening?

This is my first attempt at tweaking an APEX. It is a e-mail template for Invoice which is generated from "Send E-mail" within Opportunity. I am getting: " Error: Unknown property 'core.email.template.EmailTemplateComponentController.Opportunity' " when I am trying to save. What am I missing here?

 

 <messaging:emailTemplate subject="Your invoice" recipientType="Contact"  
relatedToType="Opportunity">
<messaging:htmlEmailBody >
 
<table border="0" cellspacing="0" cellpadding="10" width="700" id="table1" align="center">
<tr>
    <td width="230">
        <img src='{!URLFOR($Resource.PixLogo70pix)}' title=" Logo" />
    </td>
    <td align="right"><font face="Arial" size="2" color="#666666"> One Broadway<br />
    </font>
    </td>  
</tr> 
</table>
<center>
    <p style="font-family:Arial;font-size:22px;font-weight:bold;color:#666666;">INVOICE</p>
</center>
<br/>
 
<table border="0" cellspacing="0" cellpadding="5" width="800" id="table1" align="center">
<tr>    <td valign="top">
    <font face="Arial" size="2" color="#666666">
    Bill To:</font><br />
    <font face="Arial" size="2">
    {!Opportunity.Account.Name}<br/>
    {!Opportunity.Account.BillingStreet}<br/>
    {!Opportunity.Account.BillingCity}, {!Opportunity.Account.BillingState} {!Opportunity.Account.BillingPostalCode}<br/>
    {!Opportunity.Account.BillingCountry}<br/>
  </font>
</td> 
        <td>&nbsp;</td>
   <td valign="top">
     <font face="Arial" size="2">
   <font color="#666666">Account Name:</font> <br/>
   {!Opportunity.Account.Name}<br/>
   <font color="#666666">Invoice Number:</font> <br/>
   {!Opportunity.Project_number__c}<br/>
   <font color="#666666">Invoice Date:</font> <br/>
   {!Opportunity.CloseDate}<br />
   <font color="#666666">Payment Terms:</font> <br/>
   <font color="#FF3300">Due Upon Receipt</font></font></td>    
</tr>
</table>
<br/>
 
<table width="800" border="0" align="center" cellpadding="3" cellspacing="1" id="table4">
<tr bgcolor="#E5E5E5"><font face="Arial" size="2" color="#666666">
       <td>Product</td>
      <td>Description</td>
       <td>Quantity</td>
       <td>Unit Price</td>
       <td>Total Price</td>
       </font>
</tr>
<tr><font face="Arial" size="2" color="#000000">
       <apex:repeat value="{!Opportunity.OpportunityLineItems}" var="line">
          <tr>
             <td>{!line.PricebookEntry.Name}</td>
             <td>{!line.Description}</td>           
             <td>{!line.Quantity}</td>
             <td><apex:OutputField value="{!line.UnitPrice}"/></td>
             <td><apex:OutputField value="{!line.TotalPrice}"/></td>
          </tr>
       </apex:repeat>  
       </font>
</tr>
<tr>
       <td bgcolor="#FFFFFF" align="right" colspan="5">
       <font face="Arial" size="2">Sub-total:&nbsp;<apex:OutputField value="{!Opportunity.Sub_Total__c}"/></font></td>
</tr>
<tr>
       <td bgcolor="#FFFFFF" align="right" colspan="5">
       <font face="Arial" size="2">Discounts:&nbsp;<apex:OutputField value="{!Opportunity.Discount_amount__c}"/></font></td>
</tr>
<tr>
       <td bgcolor="#FFFFFF" align="right" colspan="5">
       <font face="Arial">Tax:&nbsp;<apex:OutputField value="{!Opportunity.Sales_Tax__c}"/></font></td>
</tr>
<tr>
       <td bgcolor="#E5E5E5" align="right" colspan="5">
       <font face="Arial"><b>Total:</b>&nbsp;<apex:OutputField value="{!Opportunity.Amount}"/></font></td>
</tr>
</table>
<br/>
 
<p align="center"><font face="Arial">Thank you very much for you business!<br />
{!Opportunity.CreatedBy.FirstName} {!Opportunity.CreatedBy.LastName}
</font></p>
</messaging:htmlEmailBody>
 
<messaging:attachment renderAs="pdf" filename="{!relatedTo.name}">  
<table border="0" cellspacing="0" cellpadding="10" width="700" id="table1" align="center">
<tr>
    <td width="230">
        <img src='{!URLFOR($Resource.PixLogo70pix)}' title="Pixability Logo" />
    </td>
    <td align="right"><font face="Arial" size="2" color="#666666"> One Broadway<br />
</font>
    </td>  
</tr>
</table>
<center>
    <p style="font-family:Arial;font-size:22px;font-weight:bold;color:#666666;">INVOICE</p>
</center>
<br/>
 
<table border="0" cellspacing="0" cellpadding="5" width="800" id="table1" align="center">
<tr>    <td valign="top">
    <font face="Arial" size="2" color="#666666">
    Bill To:</font><br />
    <font face="Arial" size="2">
    {!Opportunity.Account.Name}<br/>
    {!Opportunity.Account.BillingStreet}<br/>
    {!Opportunity.Account.BillingCity}, {!Opportunity.Account.BillingState} {!Opportunity.Account.BillingPostalCode}<br/>
    {!Opportunity.Account.BillingCountry}<br/>
  </font>
</td> 
        <td>&nbsp;</td>
   <td valign="top">
     <font face="Arial" size="2">
   <font color="#666666">Account Name:</font> <br/>
   {!Opportunity.Account.Name}<br/>
   <font color="#666666">Invoice Number:</font> <br/>
   {!Opportunity.Project_number__c}<br/>
   <font color="#666666">Invoice Date:</font> <br/>
   {!Opportunity.CloseDate}<br />
   <font color="#666666">Payment Terms:</font> <br/>
   <font color="#FF3300">Due Upon Receipt</font></font></td>    
</tr>
</table>
<br/>
 
<table width="800" border="0" align="center" cellpadding="3" cellspacing="1" id="table4">
<tr bgcolor="#E5E5E5"><font face="Arial" size="2" color="#666666">
       <td>Product</td>
      <td>Description</td>
       <td>Quantity</td>
       <td>Unit Price</td>
       <td>Total Price</td>
       </font>
</tr>
<tr><font face="Arial" size="2" color="#000000">
       <apex:repeat value="{!Opportunity.OpportunityLineItems}" var="line">
          <tr>
             <td>{!line.PricebookEntry.Name}</td>
             <td>{!line.Description}</td>           
             <td>{!line.Quantity}</td>
             <td><apex:OutputField value="{!line.UnitPrice}"/></td>
             <td><apex:OutputField value="{!line.TotalPrice}"/></td>
          </tr>
       </apex:repeat>  
       </font>
</tr>
<tr>
       <td bgcolor="#FFFFFF" align="right" colspan="5">
       <font face="Arial" size="2">Sub-total:&nbsp;<apex:OutputField value="{!Opportunity.Sub_Total__c}"/></font></td>
</tr>
<tr>
       <td bgcolor="#FFFFFF" align="right" colspan="5">
       <font face="Arial" size="2">Discounts:&nbsp;<apex:OutputField value="{!Opportunity.Discount_amount__c}"/></font></td>
</tr>
<tr>
       <td bgcolor="#FFFFFF" align="right" colspan="5">
       <font face="Arial">Tax:&nbsp;<apex:OutputField value="{!Opportunity.Sales_Tax__c}"/></font></td>
</tr>
<tr>
       <td bgcolor="#E5E5E5" align="right" colspan="5">
       <font face="Arial"><b>Total:</b>&nbsp;<apex:OutputField value="{!Opportunity.Amount}"/></font></td>
</tr>
</table>
<br/>
 
<p align="center"><font face="Arial">Thank you very much for you business!<br />
{!Opportunity.CreatedBy.FirstName} {!Opportunity.CreatedBy.LastName}
</font></p>
</messaging:attachment>      
</messaging:emailTemplate>

 

 

I copied the example in the Visualforce documents directly from the webpage . The 'next/previous' links  don't work. No javascript errors, just a page refresh.  like it's not rerunning the query.

 

Am I missing something? I can't imagine the example is actually broken....Do I have to write my own paginig handlers?

 

thanks for any advice,

Al

I am using email services to process email-to-case. My code correctly creates the case and updates the case when a reply is received. However, even though I am using the DML options to trigger user email, the case owner does not receive a notification when a reply is received. Cases/emails sent through the email-to-case service notify correctly.

 

Ideas?

Hi,

 

we're testing out Sites and want to provide a catalog of 'success stories'  where each 'story' consist of 4 parts

 

1) Title

2) Description

3) PDF for download

4) an associated image

 

Static resources will not provide what we need, CRM Content does (but the Sites Guest User can't be given a Content License)  - so how are people addressing this?

 

I thought about a custom object but there isn't a 'lookup field' so I can link the story to an image file. Looking at the catalogs on other Sites, they all seem to serve image files using "force.om/servlet/servlet.FileDownload?file=XXXX"  -

 

Does this mean that people are creatng custom objects and then using attachments to provide related docs/images ? I assume I'd just write controller logic to find attachments for a given record and then display them with standard visualforce components [i.e. apex:image, etc]

 

example: the cookbook http://thecookbook-developer-edition.na6.force.com/Home

 

thanks for any ideas you might have!

 

AJ

The query below that returns everything I need to build a list of Content Documents for a given ContentWorkspace. What I can't seem to do is build a URL, using the ContentDocumentId, that will allow for downloading of the document in a Sites VF page.

 

Query

--------

Select Id, ContentWorkspaceId, ContentDocumentId, CreatedDate, SystemModstamp, IsOwner, IsDeleted,
ContentDocument.Id, ContentDocument.Title, ContentDocument.PublishStatus
From ContentWorkspaceDoc
Where contentWorkspaceId = '058500000004COF' and ContentDocument.PublishStatus ='P'
order by ContentDocument.Title

 

 

If I deliver the Content Document I get a URL that I can create a link with but I do NOT see that Id used in the link below in my query at all. The link looks like this.

<a href="https://na3.salesforce.com/sfc/p/300000000ETq0R76A1g2d65F.RjvA2za5BXBKZg=">My Doc</a>

 

Any help or pointers in the right direction would be greatly appreciated.

 

Thanks,
Phillip

Can someone point me to the documentation of the proper way to query if a user (or the user's profile) has edit permission at an Object's field level?

 

example - "If the user's $Profile has permission to edit a Contact's email field, display this apex:outputText message on the visualforce page"



pseudocode - <apex:outputText render="$Profile.hasPermission(Contact.email, 'Edit')"> Important Message about Emails! </apex:outputText>

 


 I know I could hard code permission checks based on Profile Names/Ids (but I would like to avoid this practice - if I can).

 

I tried using getDescribe to traverse the Profile->Permissions relationships but I couldn't do it.

 

Thanks for any pointers!

Message Edited by icemft1976 on 03-16-2010 10:09 AM
Message Edited by icemft1976 on 03-16-2010 10:55 AM

I have a custom object (Letter_Of_Agreement) that has an Account record as it's master.

 

I was hoping to be able to leverage the existing related list mechanism to display the Account's contacts on a visualforce page (the page is using the LOA controller). 

 

 

Is it possible to reference the parent relationship of an object in a related list in some way?   i.e. <apex:relatedList list="Account__r.Contacts"  />

 

No matter the variation I use, I get an error "List attribute parent name 'account/account__r/etc' is an invalid field name for entity LOA"

 

 

Should I just recreate the related list functionality & look with a custom query and some visualforce?

Message Edited by icemft1976 on 03-03-2010 07:17 AM

Hello,

 

I have a problem with the @Future in Apex and a VisualForce page.

 

Problem:
I need a function that can create PDF files out of a VF page and send this byEmail. And I want to processes many records (between 150 and 750 records) byclicking 1 button.

Tried this:
I have a APEX class that is executed @Future.
This Class will select some records (accounts) and then loop these records.
In this loop an existing VF page is "called"/"created" withthe record ID as parameter. This page is a VisualForce page withRenderAs="PDF".

So I just want to get a PDF file based on that VF page and the record ID.

Then I want to send out an email with some of these PDF files as attachments.

When I run this code on a selection with 1 record and I don't use @future,everything works. I recieve an email with a PDF attachment and the rightcontent is in the PDF.

When I run this code on many records and don't use @future, I get a time outerror in the browser.

When I run this code on many records and use @future, It seems to work becauseafter a while I recieve an email with many attachments, but I can not open theatatchments because they are no good PDF files and all of the same size : 2 kb. The normal PDF should be like 14 KB.

How can I fix this?

 

Kind regards,

 

Bart Caelen

Adapti 

Message Edited by AdaptiDev on 01-22-2010 05:33 AM
Message Edited by AdaptiDev on 01-22-2010 06:13 AM
I'm having a hard time finding any examples of this....is anyone using the sites technology to expose org information to internal employees that do not have SF licenses?  Specifically, I have a requirement for a group of users to view and update information coming in to SF from a web-to-lead form.  This is the only SF functionality they need, so it is cost prohibitive to buy licenses for them but I need more than email alerts.  If anyone can point me in the right direction I would greatly appreciate it!

Hello!

I just started using VF with Developer license, without any previous experience in Java and HTML and trying to create approval process with custom Objects and pages using standard (built in) approval setup.

I want to show Approval history on my VF page.

As I read on I-net, I need to extend standard controller (I think there should be some Approval controller) and now, for curiosity too, I am trying to extend any standard controller (as in example below - from the Internet), but I am always getting an error:

 

Compile Error: Method does not exist or incorrect signature: stdController.getRecord() at...

 

Is it related to my Developer license, or something wrong in this code (but from other posts, i see, that many people using same code)? 

Thank you. 

 

The following class is a simple example of a controller extension:

swfobject.registerObject("clippy.d3703e55", "9");
public class myControllerExtension {    private final Account acct;        // The extension constructor initializes the private member         // variable acct by using the getRecord method from the standard         // controller.         public myControllerExtension(ApexPages.StandardController stdController) {        this.acct = (Account)stdController.getRecord();    }    public String getGreeting() {        return 'Hello ' + acct.name + ' (' + acct.id + ')';    }}

The following Visualforce markup shows how the controller extension from above can be usedin a page:

swfobject.registerObject("clippy.d3703e64", "9");
<apex:page standardController="Account" extensions="myControllerExtension">    {!greeting} <p/>    <apex:form>        <apex:inputField value="{!account.name}"/> <p/>        <apex:commandButton value="Save" action="{!save}"/>    </apex:form></apex:page>