• gtuerk
  • NEWBIE
  • 445 Points
  • Member since 2008

  • Chatter
    Feed
  • 17
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 42
    Questions
  • 115
    Replies

I have been trying to implement page numbering to a visualforce quote pdf and have been following this link:

 

http://wiki.developerforce.com/index.php/Creating_Professional_PDF_Documents_with_CSS_and_Visualforce

 

I have added the css code to the vf page, but the page numbering is not appearing. What do I need to do to finish this task?

 

Below is my code:

 

 

<apex:page standardController="Quote" extensions="dataTableCons,MyConsoleController" standardstylesheets="false" renderAs="pdf" showHeader="false">
<head>
<style>
.pheader
{
 width: 357px;
 height: 5px;
 background-color: gray;
 color: White;
 font-size:8pt;
 text-align: left;
 padding-left: 10px;
}
integer counter = 0;
@page {
 size: portrait;
    @bottom-right {
      content: "Page " counter() " of " counter(pages);
    }
}    
</style>
<apex:stylesheet value="{!URLFOR($Resource.BudgetQuoteCSS)}"/> 
</head>

    <apex:form id="theForm">  
       <apex:pageBlock tabStyle="account">
            <apex:pageMessages />
          <apex:pageBlockSection columns="1" >
         <apex:pageblockSectionItem >
         <apex:image url="/resource/1272645408000/Logo" width="187.5px" height="75px"/>

             <span style="z-index:-50;
    display:block; width:637px; margin-left:-63px; margin-top:80px;
    font-size:16px; line-height:8px; font-weight:bold;">
            BUDGET QUOTATION:
            </span>
            </apex:pageBlockSectionItem>
            <apex:outputlabel value="" >
             <span style="z-index:-50;
    display:block; width:637px; margin-left:560px; margin-top:-14px; margin-bottom:-14px;
    font-size:16px; line-height:8px; font-weight:bold;">
            <apex:outputField value="{!quote.name}" />
            </span>
            </apex:outputlabel>
            </apex:pageBlockSection>
           <apex:pageBlockSection title="Customer Information" columns="1"  showHeader="false">
                <apex:outputlabel value="" >
                <span style=" float:z-index:452;margin-left:0px; margin-top:-42px; font-weight:bold; font-size:12px; text-transform:uppercase;
                    text-underline:none;">
                <apex:outputField value="{!quote.Opportunity.AccountId}" />
                </span>
                </apex:outputlabel>
            </apex:pageBlockSection>
            <apex:pageBlockSection columns="1" showHeader="false">
                 <apex:outputLabel value="">          
                <span style="margin-left:0px;width:637px;">
                <apex:outputField value="{!quote.BillingStreet}" styleClass="white-space:pre;" />
                </span>
                </apex:outputlabel>
             <span style="float:left; width:637px; margin-left:-402px; margin-top:-10px; z-index:-8;white-space:pre;">
                
                <apex:outputField value="{!quote.BillingCity}"/>
                
                                </span>
                <span style="float:left; margin-left:-402px; margin-top:-28px; z-index:-8;">
                   <apex:outputfield value="{!quote.BillingCountry}"/>
                </span>         
           </apex:pageBlockSection>

                <span style="float:left; font-size:10px;margin-top:-3px; z-index:-8;">            
            <apex:pageBlockSection title="Customer Contact Info" showHeader="false" columns="1"   >
                <apex:outputLabel value="Attn:">
                <span style="margin-left:20px; z-index:10;">
                <apex:outputField value="{!quote.Contact_Salutation_Name__c}" />
                </span>
                </apex:outputLabel>
  
                <apex:outputLabel value="Phone:">
                <span style="margin-left:8px; z-index:10;">
                <apex:outputField value="{!quote.Phone}" />
                </span>
                </apex:outputLabel>
                <apex:outputLabel value="Fax:">
                <span style="margin-left:21px; z-index:11;">
                <apex:outputField value="{!quote.fax}"/>
                </span>
                </apex:outputLabel>
                <apex:outputLabel value="E-mail">
                <span style="margin-left:12px; z-index:10;">
                <apex:outputField value="{!quote.email}" />
                </span>
                </apex:outputLabel>
            </apex:pageBlockSection>
            </span>
              <span style="z-index:-50;
             display:block; width:637;  text-align:right; margin-top:-145px; margin-right:83px;
    font-size:12px; line-height:8px; font-weight:bold;">
            <apex:outputlabel value="" >
            <apex:outputField value="{!quote.Created_Date__c}" />
                        </apex:outputlabel></span>

        <div style="width:700px margin-top:-220px;">
           <Table class="table">

            <apex:pageBlockSection title="Project Scope"  showHeader="true" columns="1">
                <apex:outputLabel title="">
                    <span style="float:left; margin-left:0px; line-height:12px; width:637px;">
                     <apex:outputField value="{!quote.Project_Scope__c}" />
                  </span>
            </apex:outputLabel>

             </apex:pageBlockSection>

            </Table>
          </div>
       </apex:pageBlock>
       
       </apex:form>

    <apex:pageBlock >
    <apex:pageBlockSection title="Product List" showHeader="true" columns="2">
      <apex:dataTable value="{!QuoteLineItems}" rowClasses="even,odd," var="line"  width="630">
        <apex:column style="text-align:right;" headerClass="header1" headerValue="Item">
        <apex:facet name="Item">Item</apex:facet>
        <apex:outputText value="{!line.Quote_Item_Number__c}"/>
        </apex:column>  

        <apex:column style="text-align:left;
            border-left-style:solid; border-left-color:black;
            border-left-width:.25px;"
          headerClass="pheader" headerValue="Product">
        <apex:facet name="header">Product</apex:facet>
        <apex:outputText value="{!line.Description}"/>
        </apex:column>        
        <apex:column style="text-align:right;
            border-left-style:solid; border-left-color:black;
            border-left-width:.25px;" headerClass="header2" headerValue="Quantity">
        <apex:facet name="header">Quantity</apex:facet>
        <apex:outputText value="{!line.Quantity__c}"/>
        </apex:column>
    <apex:column style="text-align:right;
            border-left-style:solid; border-left-color:black;
            border-left-width:.25px;" headerClass="header2" headerValue="Price Each">
        <apex:facet name="header">Price Each</apex:facet>
        <apex:outputText value="{!line.Price_Each__c}"/>
        </apex:column>
    <apex:column style="text-align:right;
            border-left-style:solid; border-left-color:black;
            border-left-width:.25px;" headerClass="header2" headerValue="SubTotal">
        <apex:facet name="header">SubTotal</apex:facet>
        <apex:outputText value="{!line.Subtotal__c}"/>
        </apex:column>        
      </apex:dataTable>
      </apex:pageBlockSection>
   </apex:pageBlock>
  
        <apex:form >      
       <apex:pageBlock >
           <apex:pageBlockSection >
              <span style = "border-top-width:.25px; margin-left:-236px;">
            <apex:outputlabel value="Total"/>
            </span>
              <span style = "display:block; width:363px; text-align:right; margin-top:-15px; margin-right:1px;">
              <apex:outputlabel value="">
              <apex:outputField value="{!quote.Subtotal__c}"/>
              </apex:outputlabel>
              </span>
           </apex:pageBlockSection>
       </apex:pageBlock>
       <apex:pageBlock >
       <div style="width:800px; text-align:left;">
             <apex:pageBlockSection title="Terms" showHeader="true" columns="1" >
             <apex:outputlabel value="Estimated Lead Time">
             <span style="margin-left:53px; z-index:20">
                <apex:outputField value="{!quote.Estimated_Lead_Time__c}"/>
             </span>
                </apex:outputLabel>
                <apex:outputLabel value="Incoterms 2010">
                <span style="margin-left:91px; z-index:10;">
                <apex:outputField value="{!quote.INCO_Terms__c}" />
                </span>
                </apex:outputLabel>
             <apex:outputlabel value="Payment Terms">
             <span style="margin-left:77px;">
                <apex:outputField value="{!quote.Projected_Payment_Terms__c}"/>
             </span>
                </apex:outputLabel>
             <apex:outputlabel value="">
             <span style="margin-left:150px;">
                <apex:outputField value="{!quote.Custom_Payment_Terms__c}"/>
             </span>
                </apex:outputLabel>

             </apex:pageBlockSection>
             </div>
       </apex:pageBlock>
       
       <apex:pageBlock >
       <div style="table2">
           <apex:pageBlockSection title="For Further Information, Please Contact:" showHeader="true" columns="1">
             <apex:outputlabel value="">
                <apex:outputField value="{!quote.Prepared_by__c}"/>
             </apex:outputlabel>
Key Technology, BV
             <apex:outputlabel value="">
                <apex:outputField value="{!quote.Preparer_s_Phone_Number__c}"/>
             </apex:outputlabel>
             <apex:outputlabel value="">
                <apex:outputField value="{!quote.Preparer_s_Email__c}"/>
             </apex:outputlabel>
        </apex:pageBlockSection>

       </div>
       <span id="pagenum"/>
       </apex:pageBlock>
       <div style="page-break-after:always;"/>
       Test for Page2
       
       
      </apex:form>

</apex:page>

 

 

I'm a Visualforce newbie, so apologies for the very basic question:

 

Is it possible to access data across multiple objects (standard and custom) and then present in a single Visualforce page? If so, how is this accomplished?

 

Thanks.

Hi,

 

I have mistakenly deployed a couple of classes to our production environment through Eclipse and I want to delete them but there's no option for that inside salesforce. I have the option to delete deployed components though. Any suggestions?

 

Thanks.

  • September 30, 2009
  • Like
  • 0

Newbie here. Please be gentle :)

 

I'm attempting to display (and then edit) a related list.

 

Error (it says line 0):

 

Save error: Unknown property 'Bookings_Forecast__cStandardController.lForecasts'

 

 Custom Controller:

 

public class ForecastBookingsTest {

String StatusText;
public List<Monthly_Forecast__c> lForecasts;
Boolean InsertFlag;
private final Bookings_Forecast__c BF;

// Constuctor for extending the standard controller
public ForecastBookingsTest(ApexPages.StandardController stdController) {
this.BF = (Bookings_Forecast__c)stdController.getRecord();
StatusText = '';
lForecasts = ForecastList();
InsertFlag = false;
}

// Fill list with Forecasts
public List<Monthly_Forecast__c> ForecastList(){
List<Monthly_Forecast__c> fl;
try {
fl = [Select c.id, c.Bkgs_Fcst_Amt__c, c.Shippable__c, c.Est_Bkgs_Amt__c, c.Left_to_Book__c, c.Comments__c, c.Date__c
from Monthly_Forecast__c c where c.Bookings_Forecast__c = :BF.id];
} catch (QueryException e){
system.debug(e.getMessage());
StatusText = e.getMessage();
}
return fl;
}

// Called from Grid to get List of Forecasts
public List<Monthly_Forecast__c> getForecasts () {
if (InsertFlag){
lForecasts.add(new Monthly_Forecast__c(Bookings_Forecast__c = BF.id));
InsertFlag = false;
}
return lForecasts;
}

// Called from Page to pass values from grid to controller
public void setForecasts(List<Monthly_Forecast__c> mf) {
lForecasts = mf;
}

// Called from Page to get StatusText
public String getStatusText() {
return StatusText;
}

// Called from "Save" Button
public PageReference saveForecasts () {
try {
upsert lForecasts;
} catch (DMLException e) {
system.debug(e.getMessage());
StatusText = e.getMessage();
}
lForecasts = ForecastList();
return null;
}

// Called from "Add" Button
public PageReference addForecast () {
InsertFlag = true;
return null;
}
}

 

 Page:

 

<apex:page standardController="Bookings_Forecast__c" extensions="ForecastBookingsTest" title="Test Bookings Forecast (Lee)" showHeader="true" sidebar="true">
<apex:detail relatedList="false" title="true"/>
<apex:form >
<apex:pageBlock title="Monthly Forecasts" id="gridform">
<apex:pageBlockButtons >
<apex:commandButton action="{!saveForecasts}" value="Save" id="SaveForecastButton" rerender="gridform" status="status"/>
<apex:commandButton action="{!addForecast}" value="New" id="AddForecastButton" rerender="ForecastTable" status="status"/>
</apex:pageBlockButtons>
<apex:dataTable value="{!lForecasts}" var="item" id="ForecastTable" rowClasses="odd,even" styleClass="" rules="rows" width="100%" columnsWidth="60px">
<apex:column headerValue="Action">
<b><apex:outputLink value="/{!item.id}/e" id="editLink">Edit</apex:outputLink>
|&nbsp;
<apex:outputLink id="delLink" onclick="if ((Modal.confirm && Modal.confirm('Are you sure?')) || (!Modal.confirm && window.confirm('Are you sure?'))) navigateToUrl('/setup/own/deleteredirect.jsp?delID={!item.Id}&retURL=/apex/ForecastBookingsTest?id={!Forecast_Bookings__c.id}');">Del</apex:outputLink></b>
</apex:column>
<apex:column headervalue="Monthly Forecast Name"><apex:outputLink value="/{!item.Id}" target="_self">{!item.name}</apex:outputLink></apex:column>
<apex:column headervalue="Bkgs Fcst Amt" value="{!item.Bkgs_Fcst_Amt__c}"/>
<apex:column value="{!item.Shippable__c}"/>
<apex:column value="{!item.Est_Bkgs_Amt__c}"/>
<apex:column value="{!item.Left_to_Book__c}"/>
<apex:column value="{!item.Comments__c}"/>
<apex:column value="{!item.Date__c}"/>
</apex:dataTable>
<apex:actionStatus id="status" startText="Requesting..." stopText="Data Retrieved!"/>&nbsp;{!StatusText}
</apex:pageBlock>
</apex:form>
</apex:page>

 

I'm sure I'm missing something simple.

 

Thanks,

 

lee

 

 


 

 

 

 

 

I have written a sample Flex code and i tried to invoke it through a visual force page.

 

1. 

 

It worked fine with my developer instance(i.e., it was fetching the desired records). But it is not working with the Sandbox instance.

 

The connection part of the code [developer]:

 

 

<salesforce:Connection id="conn" serverUrl="https://www.salesforce.com/services/Soap/u/16.0" />

 

 and for sandbox:

  <salesforce:Connection id="conn" serverUrl="https://test.salesforce.com/services/Soap/u/16.0" />

Is there any modification that i need to do here to make it work in sandbox? [But, it was able to fetch the records when i tried to run the code directly from Flex builder].

Any help on this matter will be appreciated.

 

2.

 

Issue while authenticating:

 

I have tried to directly passing the username and password by hardcoding them in the code and also through Session ID.

Both of them Failed.

 

I would ideally like to pass the session Id and make it work

 

[However, both the methods worked in my developer edition]

 

private function doLogin():void
{
var lr:LoginRequest = new LoginRequest();

lr.username = "mySandboXusername@mydomain.com.test";
lr.password = "$$$$$$$$$$";

//lr.session_id = this.parameters.sid;
//lr.server_url = this.parameters.surl;

lr.callback = new AsyncResponder(loginResult, loginFault);
conn.login(lr);
}

 

 

 The Visual Force page from where i am invoking the flex is:

 

 

<apex:page >
<apex:pageBlock title="Flex Page">
<apex:flash src="{!$Resource.flex}" width="500" height="300" play="true" />
flashvars="sid={!$Api.Session_ID}&surl={!$Api.Partner_Server_URL_90}"/>

</apex:pageBlock>
</apex:page>

 

 The query part involved in the flex code is:

 

 

private function loginResult(result:Object):void
{
conn.query("SELECT Id, Contact.Firstname,phone, Contact.Lastname FROM Contact",
new AsyncResponder(queryResult));
}

 

 

 

Can some one please help me out on this.

If not,  even if you can even point me in the right direction, that would be great!

 

 

 

 

Message Edited by Javaj on 06-26-2009 06:13 AM
  • June 26, 2009
  • Like
  • 0

Hello,

I've recently started working with triggers and I seem to be having problems with custom objects.  I've tried this a few different ways, but I get either Invalid Type(what this is getting now) or Invalid sObject if I try to query SFDC_Bug_c.  

 

Any help you could give me would be greatly appreciated.

 

Thanks,

 

 

trigger SendToBug on Case (before update) {
   
    for(Case c : Trigger.new){
        if(c.Reason == 'Bug')   
            SDFC_Bug_c b = new SDFC_Bug_c(Status_c='Open', Priority_c='P3-Medium', Problem_Description_c = c.Description);
            insert b;
           
    }
}

i understand that it's possible to pull the related object info into the body of the email, but is it possible to pull related object info into the subject line.

 

Here's an example which works, because it's a non-dynamic subject line:

 

<messaging:emailTemplate subject="A non-dynamic subject" recipientType="Contact" relatedToType="Case"> <messaging:plainTextEmailBody > Congratulations! This is your new Visualforce Email Template. </messaging:plainTextEmailBody> </messaging:emailTemplate>

 This is what i'd like to do

 

<messaging:emailTemplate subject="{!case.product__c} Case: {!case.casenumber} - {!case.subject}" recipientType="Contact" relatedToType="Case"> <messaging:plainTextEmailBody > Congratulations! This is your new Visualforce Email Template. </messaging:plainTextEmailBody> </messaging:emailTemplate>

 

 but when saving, salesforce complains about the Case controller.

 

I have a custom controller and apex page associated with it. I am posting the page with button click in account page layout. When my apex page is displayed I want to display some values from account object like name, city. my customer controller with all the logic in it and works fine.

 

1. My page starts with the line 

  <apex:page Controller="MyCustomSelController">

  Can I add StandardController = "Account" to get the account fields?

2. How do I use standardController and pass the values to my custom controller?

 

Thanks

Uma

 

  • March 03, 2009
  • Like
  • 0


Update:
I tried a bit an made the method with queries alle case-emails returning the value itself:

 public List<EmailMessage> ViewData(string incId) {

 
  String query = 'Select ToAddress, TextBody, SystemModstamp, Subject, Status, ParentId, '
  + 'MessageDate, LastModifiedDate, LastModifiedById, IsDeleted, Incoming, '
  + 'Id, HtmlBody, Headers, HasAttachment, FromName, FromAddress, CreatedDate, '
  + 'CreatedById, CcAddress, BccAddress, ActivityId '
  + 'From EmailMessage WHERE '
  + 'ParentId = \''+ incId + '\'';
  //+ 'ParentId = \''+ incident.Id + '\''; 
 
 myquery = query;
 myEmail = Database.query(query);
 return myEmail;
 }
 
 
but now my apex page can't access the controller extension:

<apex: page standardController="Case" extensions="mySendMail" action="{!ViewData}" id="mySendMail_PageLoad">
results in >>> Unknown method 'CaseStandardController.ViewData() <<<<

why is that? i did this because i wanted to access the method from my testclass with a case id 
and compare the anticipated results.

please note that incident and case are the for the same thing

__________________________________________________________________________________________

Hi there, i'm a bloody beginner in apex and i don't know how to write a simple test-class 
for the following controller extension of the case controller : 

it was written to avoid an "email to:" field from beeing filled with the
standard contact for the account associated with the case when replying to a mail
in the case. it is called in a special section within the case-vf page. all emails
for this case are displayed an can be replyed by link. it works perfectly but must be
tested as you know. 


public class mySendMail {
 
  private List<EmailMessage> myEmail;
  public List<EmailMessage> getmyEmail() {return myEmail;}
  public string myquery {get;set;} // testqueryoutput in page
  public string caseId {get;set;} // caseId-exchange
 
 
 //standardcontrollerfunctionality
  Case incident;
  ApexPages.StandardController controller;
  public mySendMail(ApexPages.StandardController controller) {
  this.controller = controller;
  this.incident = (Case)controller.getRecord();
  } 
 
 public PageReference ViewData() {
 
  String query = 'Select ToAddress, TextBody, SystemModstamp, Subject, Status, ParentId, '
  + 'MessageDate, LastModifiedDate, LastModifiedById, IsDeleted, Incoming, '
  + 'Id, HtmlBody, Headers, HasAttachment, FromName, FromAddress, CreatedDate, '
  + 'CreatedById, CcAddress, BccAddress, ActivityId '
  + 'From EmailMessage WHERE '
  + 'ParentId = \''+ incident.Id + '\''; 
 
 myquery = query;
 myEmail = Database.query(query);
 return null;
  
  
 }

}


the code below is my testclass attempt so far. i have no idea how to call
a testcase of mine from which i know what emails and their subjects are.
i simply wanna compare the amount of emails or some or one subject.  


@IsTest private class mySendMailTest {
 
   
  //initializing the standard case controller  
  ApexPages.StandardController con = new ApexPages.StandardController(new Case());
   
  //initializing the controllerextension
  mySendMail ext = new mySendMail(con);

  public static testmethod void basicTest() {

   
   
   
  }



}

 

 

 

 

 

Message Edited by jobo on 02-26-2009 09:21 AM
  • February 26, 2009
  • Like
  • 0

Ultimately I'm trying to display a list of opportunities in a paging and sortable way. apex:EnhancedList seemed perfect for what I need, but I can seem to feed it my opportunity list.

 

Page sample: 

<apex:enhancedList listId="MyOppList" height="300"/>

 

Controller sample:

 

public Opportunity[] getMyOppList() {

return [select id, name from Opportunity];

}

 



How do you use listId? All the docs say is "The Salesforce object for which views are displayed"

 

I just refreshed a Development sandbox and wanted to verify that if I tried to deploy to our production env (from which we refreshed, duh) without making changes that no deployment candidates would be recognized.  HOWEVER, many of our Custom Objects, some standard objects, 2 VF pages, 2 VF components and 1 S-Control were recognized as different by the Deployment Manager in Eclipse.  I've verified this with local project created in Eclipse 3.4 as well as 3.5. No changes were made to production after the refresh of the sandbox.  What could be the problem?

  • October 05, 2010
  • Like
  • 0

Hi.  Are Deployments (available through Monitor Deployments) capable of being queried?  I'd like to be able to query for deployments and get the overall code coverage, validate only flag, number of components, deployer, etc so that I can build dashboards against these.  Is that available or should I put something on Idea Exchange?

  • August 12, 2010
  • Like
  • 0

I had hoped to answer my own question on this but it looks less than promising as I cannot effectively troubleshoot with the tools available to Content developers.  I've created various ContentTypes in the past.  Before Summer '10, we had no problems with using polymorphic ContentTypes to allow for programmatic upload and association of Content to Custom Objects.  Coinciding with the Summer '10 release, we attempted to clean-up our 'Template' for Content (the General content type). 

 

It seems like our page layout assignment mapping to Content record types may have been compromised as part of that clean-up.  Unfortunately, ContentVersion does not have the same ability to look at Page Layout Assignments nor the same basic ability to manage record types (you cannot delete a ContentType once it has been 'assigned').  So what I've got is that new ContentTypes are all getting the page layout of the base type (which appears duplicated in the list of selectable ContentTypes in our Workspaces as 'General Document(Template)').

 

Duplicated Content Types

 

Anybody encounter this before?  thanks

g

 

 

I've implemented many custom lookup fields from ContentVersion to our Custom objects to support automating the relationship between object instances and Content.  I cannot customize this related list to add any fields from Content (besides title, created date and last modified date).  Although I'd love to have actions (like download, edit, delete), I really desparately need the record count to be truly reflective of what's related to the object.  Currently, the list shows 10 records, you can ask to see 10, 20, 40, etc more, but each of those is a click.  Ideally, I would have a 'Go To List' hyperlink at the bottom of the related list LIKE ANY OTHER RELATED LIST!!!  I'm thinking I'll need to do a custom related list for this but just wanted to check...

 

 Content Related List

I would like to be able to display multiple thumbnails of uploaded images that are stored using CRM Content on a single Visualforce page.  I'm able to get ContentDocuments and ContentVersion using SOQL but am unclear on how to embed this content.  Ideally, I would use the apex:image tag within a repeat using a bound list of ContentVersion elements.  Has anybody done something similar?

  • March 02, 2010
  • Like
  • 0
Is there an eclipse setting that cascades the refresh down to all assets?  When I refresh from Server on anything other than a single asset (.class, .object, .trigger, etc), the assets do not pick up changes from server.  If I click on one asset and refresh, the asset is successfully refreshed with the latest.  This started happening when I updated my Eclipse to 3.4.2 (I only got this 'behavior' with email templates in 3.3 - all other refreshes were met with success).  Eclipse setting?  Ideas?
  • February 15, 2010
  • Like
  • 0
I'm executing some anonymous Apex from the (changed) System Log in tapp0, which has recently been upgraded to Spring '10.  Although I have a Scheduled class and have used System.schedule to schedule the job, I don't see succcess in the system log and the scheduled job does not appear in my list of scheduled jobs.  Is something funny going on with the Pilot?  this is critical functionality for our organization.
  • January 27, 2010
  • Like
  • 0
One of my users received this error message.  I believe it relates to the amount of logging going on in our implementation.  can anybody confirm?  I can't find reference to this in SF documentation
  • January 21, 2010
  • Like
  • 0
Is there a way to secure access to the Codebase (disallow view/edit) but still allow users to upload using the data loader?  I think the API Access checkbox controls access to both, right?
  • December 15, 2009
  • Like
  • 0

I am using a static resource which is our company's logo in a visualforce email.  I get the image to show up when previewing from the app but not when the email is delivered.  I noticed another post that indicates you may need to construct the url for the image in a different way (like in a controller class).  Any ideas?

 

<apex:image value="{!URLFOR($Resource.ZayoLogo)}"/>

 

 

  • December 14, 2009
  • Like
  • 0

I have uploaded various documents through the Content API in preparation for moving document management capabilities into Salesforce.  We are excited about the use of the Content management system to be able to version control and tie our documents to the appropriate context elements.  I've noticed that there appears to be some limit to the file size for preview.  Unfortunately, this upper bound is pretty low.  I'm seeing a warning/info message in the preview pane that says 'Processing File' with a refresh link.  Leaving the browser alone, I don't see any progress. Clicking the refresh link (although very gratifying) does nothing either. 

 

 

The (seemingly aribtrary and inconsitent) limit appears to be ~3.0 MB.  Documents smaller than that file size render in the preview window; those greater in size do not.  

 

Please confirm

Message Edited by gtuerk on 12-07-2009 01:43 PM
  • December 07, 2009
  • Like
  • 0
The publish process seems to be successful but the data loader hangs for a long period of time while the publishing process completes.  It also doesn't tell you the interim number of successes/failures so you can determine how well the upload is working.  I'm using v17 of the data loader.  Once you cancel the operation, control will eventually return to the hanging app and the results are presented
  • December 02, 2009
  • Like
  • 0
I'm having some difficulty finding the API capability that allows me to associate uploaded Content (inserted into ContentVersion) with any Custom Object without using the front end.  What object(s) store the relationship from any object to associated 'RelatedContent'?
  • November 24, 2009
  • Like
  • 0

Hoping someone can point me in the right direction on a seemingly ongoing problem.  The first one I have not seen before but seems related to the other issue.  Here's what we're seeing:

 

We added a few fields to one of our Custom Objects in one of our Development sandboxes and replicated that (i.e. did not deploy but instead recreated the field) in our Production environment.  This is a typical pattern we employ when we have extended development cycles and a quick field needs to be added.  When we did the deployment this time, the field was eliminated from Salesforce and recreated - thereby losing all the data in that field.  There were no differences between the field's label, field name and/or API name so we would not have expected it to be deleted, yet it was.  Has anyone experienced this before?

 

The other problem, which we have seen a number of times, is that we sometimes have two fields with the same field ID value.  We have a (n anti)pattern in place that uses Query String parameters to pass fields from one Custom Object to another to preset the layout of the new object with values from the other object without being persistent (i.e. we don't save the record until the user explicitly does so).  More than once, the field ids of two different fields have the same ID.  This makes the field copy not work.  These seem related to the above but was hoping to better understand how these field ids are allocated during the deployment process to guard against these errors.

thanks in advance

  • November 09, 2009
  • Like
  • 0
I hate dead code.  And I hate dead reports.  I'd like to be able to query against the Custom Report Types in our instance and return whether or not there are active reports authored against those Custom Reports.  Is there any way to do this?  I can't find any report types in the DataLoader nor in the salesforce.schema
  • September 29, 2009
  • Like
  • 0

As of this morning, we are sometimes getting warnings added to our 'QuickView' visualforce pages that pull in information into Standard layouts.  This is happening to our sandbox on CS2.  I'm aware that the tag should be terminated.  This seems to be related to the Winter '10 upgrade...

 

WARNING

Warning:

 The element type "br" should be terminated by the matching end-tag "</br>". at line 24

 

 

Is visualforce using strict XHTML validation these days? The page tag doesn't lend itself to that

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"

 

 So why does the page (intermittently) display that html parsing warning? VF markup below (in case you care)

 

<apex:page standardController="Order_Contact_Role__c" recordSetVar="contacts"
    extensions="ContactRoleController">
    <apex:form >
        <apex:sectionHeader title="Order Contacts" />
        <apex:param id="userProfile" value="{!$Profile.Name}" />
        <apex:pageBlock title="Order Contact Selection" >
            <apex:pageMessages id="errorMessages" />
            <apex:pageBlockSection showHeader="false">
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Role" />
                    <apex:selectList value="{!selectedRole}" >
                        <apex:selectOptions value="{!selectableRoles}" />
                    </apex:selectList>
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Contact" />
                    <apex:selectList value="{!selectedContact}" size="5" >
                        <apex:selectOptions value="{!activeContacts}" />
                    </apex:selectList>
                </apex:pageBlockSectionItem>
            </apex:pageBlockSection>
            <apex:pageBlockButtons >
                    <apex:commandButton value="Add Contact" action="{!addContact}"
                    rerender="errorMessages, outputSection" />
                    <apex:commandButton value="Return to SO" action="{!returnToSO}" />
                </apex:pageBlockButtons>
        </apex:pageBlock>
        <apex:pageBlock title="Current Order Contacts" >
            <apex:pageBlockSection showHeader="false" id="outputSection" columns="1">
                    <apex:pageBlockTable value="{!contacts}" var="con">
                        <apex:column value="{!con.Contact__c}" />
                        <apex:column value="{!con.Role__c}" />
                        <apex:column value="{!con.First_Name__c}" />
                        <apex:column value="{!con.Last_Name__c}" />
                    </apex:pageBlockTable>
                </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>

 

  • September 21, 2009
  • Like
  • 0

I am using the sObject.put() method to dynamically set fields for update based on user interaction with tasks.  I'd like to be able to set DateTime value of Now() to be used in this field update.  Is there a (n easy) way to do this? 

 

Here's my snippet

 

public SObject doFieldUpdate(String fieldName, String fieldValue, SObject sobj){
        sobj.put(fieldName, fieldValue);
        return sobj;
    }

 

And what I'd like to do is either overload this method or switch in the method body to set a DateTime field's value to Now() when this is run.

 

 

  • September 21, 2009
  • Like
  • 0

I've created a Custom Object to encapsulate Location details (address, city, state, country, zip, etc).  We have many objects that lookup addresses, including Opportunity.  Users have reported and I have confirmed that the Lookup only returns 2000 records against which to apply a filter.  Advanced Search has the same limit.  Our organization is Enterprise Edition and I thought the number of query rows limit was 10k but it appears for search and lookup that it is only 2000.  Is that correct?

 

2000 Results

  • August 17, 2009
  • Like
  • 0

Hi

I work on a (distributed) team of two on our SFDC Enterprise Edition instance.  My colleague noticed a problem with the deployment tool the other day where candidates for deployment do not accurately reflect the differences between the production env and the sandbox from which we are deploying.  I didn't notice the problem until today but now I'm seeing the same thing.  Totally new Custom Objects show up as 'No Action' although they should show as 'Add', changed VF pages and Apex classes show as No Action although they should show as overwrite.  

 

Is there something corrupt with the Schema file or with metadata files associated with the code assets?

thanks

g

  • August 14, 2009
  • Like
  • 0

I have an order form that uses a collection of components that has content that is dynamically generated.  Each instance of the component checks a local variable to determine if certain content needs to be rendered.  I've noticed that once a 'false' is encountered for the component, all subsequent rendering of that component element is also rendered false.  So I skinnied this down in a different sandbox environment so that SF could have a 100% repeatable scenario to work from.

 

To prove this out, I added a custom object, embedded a VF page in that object's layout, added a controller extension that housed a member list collection (of a different wrapper class) and in the VF page I added an apex:repeat to iterate over the member collection.  Simple.  The Wrapper object takes a String when instantiated and there is a local boolean in the wrapper that returns true if the String passed to the Constructor is 'First'.  So here:

 

public class DynamicComponent {

Boolean isFirst;
public DynamicComponent(String dynamicType){
isFirst = false;

if (dynamicType == 'First'){
isFirst = true;
}
}

public Boolean getIsFirst(){
return isFirst;
}
}

 And in the page controller I instantiate 4 of these objects, 3 of which [0, 1 and 3 index] should return an isFirst of True:

 

public class DynamicController {

List<DynamicComponent> dynComps;
public DynamicController(ApexPages.StandardController controller){
DynamicComponent dynComp1 = new DynamicComponent('First');
dynComps = new List<DynamicComponent>();
dynComps.add(dynComp1);
DynamicComponent dynComp2 = new DynamicComponent('First');
dynComps.add(dynComp2);
DynamicComponent dynComp3 = new DynamicComponent('Second');
dynComps.add(dynComp3);
DynamicComponent dynComp4 = new DynamicComponent('First');
dynComps.add(dynComp4);
}
public List<DynamicComponent> getDynComps(){
return dynComps;
}
}

 

<apex:component >
    <apex:attribute name="EachElem" description="Each dynamic Element" type="DynamicComponent" required="false" />
    <apex:pageBlock title="Dynamic Element">
        <apex:pageBlockSection showHeader="false">
            <apex:pageBlockSectionItem rendered="{!EachElem.isFirst}">
                <apex:outputText value="I am rendered" />
            </apex:pageBlockSectionItem>
        </apex:pageBlockSection>
    </apex:pageBlock>
</apex:component>

 

And the VF Page, which iterates over the collection using an apex:repeat:

 

<apex:page standardController="Dynamic_Container__c" extensions="DynamicController" >
<apex:repeat value="{!dynComps}" var="eachComp">

<c:DynamicCollectionElement EachElem="{!eachComp}" />

</apex:repeat>

</apex:page>

So the expected result in this case would be 4 page blocks: first, second and fourth should have 'I am Rendered' output and the third should not.  But instead, the last one doesn't have the 'I am rendered' text.  

 

 DynamicElements

 

Also, if I change the first instantiated wrapper object to instead take a 'Second' value in the constructor, none of the component instances display the conditional text (leading me to believe the first false found causes subsequent rendering of the element to fail.  Please look into this, Visualforce friends

g

I have three custom objects: page_element, content_Item and content. element is a lookup child of content_item and content is a master-detail child of content_item.

 

I'm trying to render these on a vf page in 3 nested apex:repeats - element (outer) - content_item - content (inner).  I  have this code in a custom controller extension:

 

    public list<Page_Element__c> getElements() {
        String pgId = ValidatePageName();
        list<Page_Element__c> elements =
            [Select Name, Order_On_Page__c, Box_Size__c, Page_Layout__c, Content_Item__c, Content_Type__c
            From Page_Element__c where Page_Layout__c = :pgId order by Order_On_Page__c asc];
        return elements;
   }
    
    public list<Content_Item__c> getContentItems() {
        String pgId = ValidatePageName();
        
        list<Content_Item__c> contentItems;

        // Create a list of account records from a SOQL query  
        list<Page_Element__c> elements =
            [Select Name, Order_On_Page__c, Box_Size__c, Page_Layout__c, Content_Item__c, Content_Type__c
            From Page_Element__c where Page_Layout__c = :pgId order by Order_On_Page__c asc];
            
        // Loop through the list and generate another SOQL query using the Contact Item referenced
        for (Page_Element__c e : elements) {
            string ciID = e.Content_Item__c;
            contentItems = [select Id, URL_Link__c, Synopsis__c, Release_Date__c, Name, Heading__c,
                (select Name, Content_Item__c, URL_Link__c, Image__c, Description_Text__c
                from Contents__r order by name)
                From Content_Item__c where Id = :ciID order by Release_Date__c desc];
        }
        return contentItems;
    }

 

and this in a VF page:

 

    <apex:panelGroup layout="inlined" rendered="{!NOT(ISNULL(elements.size))}">
        {!elements.size} <br/>
        <apex:repeat var="el" value="{!elements}" >

        <apex:panelGroup layout="inlined" rendered="{!NOT(ISNULL(contentItems.size))}">
            <apex:repeat var="ci" value="{!contentItems}" >
                <div class="clearfix contentpage">
                    <h2 class="clearfix contentheading">
                        <a href="{!ci.URL_Link__c}" class="contentpagetitle">{!ci.Heading__c}</a>
                    </h2>

                     <div class="article-content">
                        <apex:panelGroup layout="inlined" rendered="{!NOT(ISNULL(ci.contents__r.size))}">
                            <apex:repeat var="c" value="{!ci.contents__r.}" >
                                <a class="logo" href="{!c.URL_Link__c}" target="_blank">
                                    <apex:outputText escape="false" styleClass="logosize"  style="float:left" value="{!c.Image__c}" />
                                </a>
                                 <apex:outputText escape="false" style="float:left" value="test {!c.Description_Text__c}" />
                            </apex:repeat>
                         </apex:panelGroup>
                      </div>
                    <br/>
 
                 </div>
             </apex:repeat>
        </apex:panelGroup>
 
        </apex:repeat>
     </apex:panelGroup>

 

The first problem I have is that the {!elements.size} returns 4 (which is what I'd expect), whilst {!contentitems.size} returns just 1 - even though it's using the exact same query as control for the for loop as 'getElements', and  {!elements.Content_Item__c} returns 4 different valid ids for Content_Item__c.

 

The second problem I have is that the vf page won't save with the inner loop using {!ci.contents__r}  - it gives me


Save error: Unknown property 'VisualforceArrayList.'

 

unless I comment out the inner loop.

 

So what am I doing wrong here, and how can I do it better?

 

Many thanks.

 

 

I have been trying to implement page numbering to a visualforce quote pdf and have been following this link:

 

http://wiki.developerforce.com/index.php/Creating_Professional_PDF_Documents_with_CSS_and_Visualforce

 

I have added the css code to the vf page, but the page numbering is not appearing. What do I need to do to finish this task?

 

Below is my code:

 

 

<apex:page standardController="Quote" extensions="dataTableCons,MyConsoleController" standardstylesheets="false" renderAs="pdf" showHeader="false">
<head>
<style>
.pheader
{
 width: 357px;
 height: 5px;
 background-color: gray;
 color: White;
 font-size:8pt;
 text-align: left;
 padding-left: 10px;
}
integer counter = 0;
@page {
 size: portrait;
    @bottom-right {
      content: "Page " counter() " of " counter(pages);
    }
}    
</style>
<apex:stylesheet value="{!URLFOR($Resource.BudgetQuoteCSS)}"/> 
</head>

    <apex:form id="theForm">  
       <apex:pageBlock tabStyle="account">
            <apex:pageMessages />
          <apex:pageBlockSection columns="1" >
         <apex:pageblockSectionItem >
         <apex:image url="/resource/1272645408000/Logo" width="187.5px" height="75px"/>

             <span style="z-index:-50;
    display:block; width:637px; margin-left:-63px; margin-top:80px;
    font-size:16px; line-height:8px; font-weight:bold;">
            BUDGET QUOTATION:
            </span>
            </apex:pageBlockSectionItem>
            <apex:outputlabel value="" >
             <span style="z-index:-50;
    display:block; width:637px; margin-left:560px; margin-top:-14px; margin-bottom:-14px;
    font-size:16px; line-height:8px; font-weight:bold;">
            <apex:outputField value="{!quote.name}" />
            </span>
            </apex:outputlabel>
            </apex:pageBlockSection>
           <apex:pageBlockSection title="Customer Information" columns="1"  showHeader="false">
                <apex:outputlabel value="" >
                <span style=" float:z-index:452;margin-left:0px; margin-top:-42px; font-weight:bold; font-size:12px; text-transform:uppercase;
                    text-underline:none;">
                <apex:outputField value="{!quote.Opportunity.AccountId}" />
                </span>
                </apex:outputlabel>
            </apex:pageBlockSection>
            <apex:pageBlockSection columns="1" showHeader="false">
                 <apex:outputLabel value="">          
                <span style="margin-left:0px;width:637px;">
                <apex:outputField value="{!quote.BillingStreet}" styleClass="white-space:pre;" />
                </span>
                </apex:outputlabel>
             <span style="float:left; width:637px; margin-left:-402px; margin-top:-10px; z-index:-8;white-space:pre;">
                
                <apex:outputField value="{!quote.BillingCity}"/>
                
                                </span>
                <span style="float:left; margin-left:-402px; margin-top:-28px; z-index:-8;">
                   <apex:outputfield value="{!quote.BillingCountry}"/>
                </span>         
           </apex:pageBlockSection>

                <span style="float:left; font-size:10px;margin-top:-3px; z-index:-8;">            
            <apex:pageBlockSection title="Customer Contact Info" showHeader="false" columns="1"   >
                <apex:outputLabel value="Attn:">
                <span style="margin-left:20px; z-index:10;">
                <apex:outputField value="{!quote.Contact_Salutation_Name__c}" />
                </span>
                </apex:outputLabel>
  
                <apex:outputLabel value="Phone:">
                <span style="margin-left:8px; z-index:10;">
                <apex:outputField value="{!quote.Phone}" />
                </span>
                </apex:outputLabel>
                <apex:outputLabel value="Fax:">
                <span style="margin-left:21px; z-index:11;">
                <apex:outputField value="{!quote.fax}"/>
                </span>
                </apex:outputLabel>
                <apex:outputLabel value="E-mail">
                <span style="margin-left:12px; z-index:10;">
                <apex:outputField value="{!quote.email}" />
                </span>
                </apex:outputLabel>
            </apex:pageBlockSection>
            </span>
              <span style="z-index:-50;
             display:block; width:637;  text-align:right; margin-top:-145px; margin-right:83px;
    font-size:12px; line-height:8px; font-weight:bold;">
            <apex:outputlabel value="" >
            <apex:outputField value="{!quote.Created_Date__c}" />
                        </apex:outputlabel></span>

        <div style="width:700px margin-top:-220px;">
           <Table class="table">

            <apex:pageBlockSection title="Project Scope"  showHeader="true" columns="1">
                <apex:outputLabel title="">
                    <span style="float:left; margin-left:0px; line-height:12px; width:637px;">
                     <apex:outputField value="{!quote.Project_Scope__c}" />
                  </span>
            </apex:outputLabel>

             </apex:pageBlockSection>

            </Table>
          </div>
       </apex:pageBlock>
       
       </apex:form>

    <apex:pageBlock >
    <apex:pageBlockSection title="Product List" showHeader="true" columns="2">
      <apex:dataTable value="{!QuoteLineItems}" rowClasses="even,odd," var="line"  width="630">
        <apex:column style="text-align:right;" headerClass="header1" headerValue="Item">
        <apex:facet name="Item">Item</apex:facet>
        <apex:outputText value="{!line.Quote_Item_Number__c}"/>
        </apex:column>  

        <apex:column style="text-align:left;
            border-left-style:solid; border-left-color:black;
            border-left-width:.25px;"
          headerClass="pheader" headerValue="Product">
        <apex:facet name="header">Product</apex:facet>
        <apex:outputText value="{!line.Description}"/>
        </apex:column>        
        <apex:column style="text-align:right;
            border-left-style:solid; border-left-color:black;
            border-left-width:.25px;" headerClass="header2" headerValue="Quantity">
        <apex:facet name="header">Quantity</apex:facet>
        <apex:outputText value="{!line.Quantity__c}"/>
        </apex:column>
    <apex:column style="text-align:right;
            border-left-style:solid; border-left-color:black;
            border-left-width:.25px;" headerClass="header2" headerValue="Price Each">
        <apex:facet name="header">Price Each</apex:facet>
        <apex:outputText value="{!line.Price_Each__c}"/>
        </apex:column>
    <apex:column style="text-align:right;
            border-left-style:solid; border-left-color:black;
            border-left-width:.25px;" headerClass="header2" headerValue="SubTotal">
        <apex:facet name="header">SubTotal</apex:facet>
        <apex:outputText value="{!line.Subtotal__c}"/>
        </apex:column>        
      </apex:dataTable>
      </apex:pageBlockSection>
   </apex:pageBlock>
  
        <apex:form >      
       <apex:pageBlock >
           <apex:pageBlockSection >
              <span style = "border-top-width:.25px; margin-left:-236px;">
            <apex:outputlabel value="Total"/>
            </span>
              <span style = "display:block; width:363px; text-align:right; margin-top:-15px; margin-right:1px;">
              <apex:outputlabel value="">
              <apex:outputField value="{!quote.Subtotal__c}"/>
              </apex:outputlabel>
              </span>
           </apex:pageBlockSection>
       </apex:pageBlock>
       <apex:pageBlock >
       <div style="width:800px; text-align:left;">
             <apex:pageBlockSection title="Terms" showHeader="true" columns="1" >
             <apex:outputlabel value="Estimated Lead Time">
             <span style="margin-left:53px; z-index:20">
                <apex:outputField value="{!quote.Estimated_Lead_Time__c}"/>
             </span>
                </apex:outputLabel>
                <apex:outputLabel value="Incoterms 2010">
                <span style="margin-left:91px; z-index:10;">
                <apex:outputField value="{!quote.INCO_Terms__c}" />
                </span>
                </apex:outputLabel>
             <apex:outputlabel value="Payment Terms">
             <span style="margin-left:77px;">
                <apex:outputField value="{!quote.Projected_Payment_Terms__c}"/>
             </span>
                </apex:outputLabel>
             <apex:outputlabel value="">
             <span style="margin-left:150px;">
                <apex:outputField value="{!quote.Custom_Payment_Terms__c}"/>
             </span>
                </apex:outputLabel>

             </apex:pageBlockSection>
             </div>
       </apex:pageBlock>
       
       <apex:pageBlock >
       <div style="table2">
           <apex:pageBlockSection title="For Further Information, Please Contact:" showHeader="true" columns="1">
             <apex:outputlabel value="">
                <apex:outputField value="{!quote.Prepared_by__c}"/>
             </apex:outputlabel>
Key Technology, BV
             <apex:outputlabel value="">
                <apex:outputField value="{!quote.Preparer_s_Phone_Number__c}"/>
             </apex:outputlabel>
             <apex:outputlabel value="">
                <apex:outputField value="{!quote.Preparer_s_Email__c}"/>
             </apex:outputlabel>
        </apex:pageBlockSection>

       </div>
       <span id="pagenum"/>
       </apex:pageBlock>
       <div style="page-break-after:always;"/>
       Test for Page2
       
       
      </apex:form>

</apex:page>

 

 

I am creating an online application that will dump into a Person Account. However when I try to instanciate the account obj in the getter I get the following runtime validation error:

 

Validation Errors While Saving Record(s) There were custom validation error(s) encountered while saving the affected record(s). The first validation error encountered was "Student Record Type: value not valid for the entity: Account".

 

Here's the VF page

 

 

<apex:page showHeader="false" controller="newStudentApplicationController" >
  <apex:sectionHeader title="Application" subtitle="Page 1 of 5"/>
  <apex:form >
      <apex:pageBlock title="Student Application" mode="edit">
         <apex:pageBlockButtons >
             <apex:commandButton action="{!save}" value="Save"/>
             <apex:commandButton action="{!cancel}" value="Cancel" 
                              onclick="return confirmCancel()" immediate="true"/>

         </apex:pageBlockButtons>
         <apex:pageBlockSection title="General Information">
             <apex:inputfield id="studentTitle" value="{!student.salutation}"/>
             <apex:inputfield id="studentFirstName" value="{!student.firstName}"/>
             <apex:inputfield id="studentLastName" value="{!student.lastname}"/>
             <apex:inputfield id="studentBirthdate" value="{!student.personBirthdate}"/>
             <apex:inputfield id="studentAffiliation" value="{!student.Affiliation__pc}"/>
         </apex:pageBlockSection>
      </apex:pageBlock>
  </apex:form>
</apex:page>

 

 

 

Here is the Controller

 

 

public class newStudentApplicationController {
    // Object Variable
    Account student;
    
    // Getters
    public Account getStudent() {
        if(student == null) {
            RecordType recType = [select id,name,sobjectType,ispersontype from recordType where ispersontype=true and sobjectType='account' limit 1];            
           // student = new Account(recordtypeid=recType.id); 
            student = new Account(); 
        }
        return student;
    }
    

 

If I try using the default constructor (commented out line above), I this error:

 

 

Validation Errors While Saving Record(s) There were custom validation error(s) encountered while saving the affected record(s). The first validation error encountered was "Student Record Type: value not valid for the entity: PersonAccount".

 

I have a feeling I am missing somethign small. Any help would be GREATLY Appreciated.

 

Thanks!

  • February 20, 2011
  • Like
  • 0

Hi,

 

I'm trying to use a custom controller with a Visualforce Email Template.  My problem is pretty simple I think.  I'm taking in a value from the custom component and I want to use it in the constructor of the controller.  I think I'm only overlooking one tiny thing to make sure everything executes in order, but it's eluding me.

 

the visualforce email template:

 

 

<messaging:emailTemplate recipientType="User" relatedToType="DAM_Digital_Asset__c"  subject="Please Approve This">

<!-- <apex:page controller="DAM_approvalsEmailController">  -->

<!-- https://c.na7.visual.force.com/apex/testmail?id=00A00000064bh3  -->
<messaging:htmlEmailBody >

<c:DAM_approvalsEmail DA_Id="{!RelatedTo.Id}" />

</messaging:htmlEmailBody>
</messaging:emailTemplate>

 

 

the component

 

 

<apex:component controller="DAM_approvalsEmailController" access="global">
  <apex:attribute name="DA_Id" type="String" description="the Digital Asset ID" assignTo="{!DA_Id}"  />

 

the controller

 

 

public class DAM_approvalsEmailController {

 public DAM_Digital_Asset__c da {get; set;}
 public String DA_Id {get; set;} 
 
 public DAM_approvalsEmailController() {
    this.da = [select id, Name, Process_Step__c, Location__c, Host_Domain__c from DAM_Digital_Asset__c where id = :DA_Id]; 
           

        }

 

 

What am I not doing correctly to get DA_Id from the component so that it can be constructed?

 

Thanks!!

 

Hi,

Before asking my question plz clarify:

UI behavior and Controlling behavior are not the same right?

 

I assumed both are not same.

I have a Custom Object: MyObj and an Apex Class: MyClass.

 

Now am trying to create a VF page with MyObj UI behavior and MyClass Controlling behavior. The code is:

 

 

<apex:page standardController="MyObj__c" controller=" MyClass">
</apex:page>
But getting an error: Error: A custom and standard controller cannot be referenced in the same page
Why can't I use both Controllers in VF page?

Thx in adv,
VNath

 

 

 

I'm a Visualforce newbie, so apologies for the very basic question:

 

Is it possible to access data across multiple objects (standard and custom) and then present in a single Visualforce page? If so, how is this accomplished?

 

Thanks.

I just refreshed a Development sandbox and wanted to verify that if I tried to deploy to our production env (from which we refreshed, duh) without making changes that no deployment candidates would be recognized.  HOWEVER, many of our Custom Objects, some standard objects, 2 VF pages, 2 VF components and 1 S-Control were recognized as different by the Deployment Manager in Eclipse.  I've verified this with local project created in Eclipse 3.4 as well as 3.5. No changes were made to production after the refresh of the sandbox.  What could be the problem?

  • October 05, 2010
  • Like
  • 0

How do I replicate these two related lists in a custom visual force page? 

 

We had to replace a default view for the object with a custom page so now we need to have this functionality (so users can attach docs from workspaces, generate deliveries and see whats related to this object). However, I can't seem to find any solution or workaround for this

 

1. There does not seem to be a special apex : * tag for these two lists, and it appears there are no documented tags in any namespace to do it either (like there is for idea and will be for chatter)

2. The regular apex:relatedList tag doesnt cut it, ther is no child relationship defined in the schema that can feed the data

3. I tried doing a custom page block but then I could not find where the ContentVersion/ContentDocument and objects meet?

4. The API is not providing the information either

 

Is there any support for content related matters in apex/VF? It seems that the many-2-many object linking objects and content documents/versions is completely hidden from us and I don't understand why, there certainly is a business case for knowing which documents are related to a case or an account (or a custom object for that matter) 

 

Is there maybe an undocumented VF tag to do it?

 

  • September 30, 2010
  • Like
  • 0

Hi,

 

I have a custom search Page, which looks at a criteria ans then returns a result to the visualforce page back in Pageblock Table.

The returned result now does not have any reference and you cannot click on any data to view the detail page.

 

How can i return data as a hyperlink to click on it to view detail page?

 

Any idea / help is highly appreciated.

 

VF Page:

 

<apex:page standardController="Account" extensions="SearchAccounts" >
    <apex:form >
        <div style="border-width:2px;border-style:solid;border-color:blue;">
            <apex:sectionHeader Title=" Step 1" subtitle="Search For Already Existing Accounts" />
         </div>
      
        <br/>
        <apex:PageBlock Title="Search Accounts">
            <apex:PageBlockSection columns="1">          
             <apex:inputField value="{!newAcct.Name}"/>  
             <apex:InputField value="{!newAcct.Site}"/>
             <apex:inputField value="{!newAcct.BillingCity}"/>
             
             </apex:PageBlockSection>                                                                                                                                       
       
        <div style="position:relative;left:230px;">
             <apex:commandButton value="Next" action="{!SearchAccount}" /> &nbsp;&nbsp;
             <apex:commandButton value="Cancel" />
        </div>  
        
        <!-- Display error message -->
             <apex:pagemessage strength="2" title="Error!!" severity="error" detail="An Account(s) Already Exists !!!" rendered="{!errormsg}"/><!-- End of error message -->
             
            <apex:pageBlockTable value="{!Results}" var="Accts" rendered="{!NOT(ISNULL(Results))}" title="Search Results">
                <apex:column headerValue="Account Name">
                    <apex:outputText value="{!Accts.Name}">
                    </apex:outputText>
                 </apex:column>
                 <apex:column headerValue="Account Site">
                    <apex:outputText value="{!Accts.Site}">
                    </apex:outputText>
                 </apex:column>
                 <apex:column headerValue="Billing City">
                    <apex:outputText value="{!Accts.BillingCity}">
                    </apex:outputText>
                 </apex:column>
            </apex:pageBlockTable>
         </apex:PageBlock>
                      
    </apex:form>
  
</apex:page>

Apex Class:

 

public class SearchAccounts {
    
     Public Account newAcct=new Account();
    public SearchAccounts(ApexPages.StandardController controller) 
    {
        

    }
    Public boolean errormsg=false;
    Public List<Account> checkDuplicates;
   
    
    Public Account getnewAcct()
    {
        return newAcct;
    }
    
     public List<Account> getResults(){
         return checkDuplicates;
        }
    
    
    
    Public Pagereference SearchAccount()
    {
        checkDuplicates=[Select Name, BillingCity, Site FROM Account where Name=:newAcct.Name And Site=:newAcct.Site And BillingCity=:newAcct.Billingcity ];
        System.Debug('Size=='+checkDuplicates.Size());
        System.Debug('Name=='+newAcct.Name);
        System.Debug('Name=='+newAcct.Site);
        if(checkDuplicates.Size()==0)
        {
            PageReference newAccount=new Pagereference('/001/e?nooverride=true');
            return newAccount;
        }
        Else
        {
        
            errormsg=true;
            return NULL;
         }
    }
    
    Public Boolean geterrormsg()
    {
        return errormsg;
    }
}

 

 

 

Thanks,

Sales4ce

Hello,

 

I have a question regarding buttons in Visualforce.   I have an HTML button on a Visualforce page within a row in a page block table.  The code for the button is as follows

 

 

<FORM METHOD="LINK"
   ACTION= "https://na3.salesforce.com/a00/e?CF00N500000020AwV={!Request__c.name}  &CF00N500000020Ax9={!p.Account__r.name}">
   <INPUT TYPE="submit" VALUE="Select Refferal"/>
</FORM>

 

When the page is rendered and I inspect the element the URL reads as follows

 

<form action="https://na3.salesforce.com/a00/e?CF00N500000020AwV=bub&CF00N500000020Ax9=Houses" method="link"><input type="submit" value="Select Refferal"></form>

 I can cut and paste this URL into my browser and the new page is properly launched.

 

However, when I click on the button in the Visualforce page, I am sent to the following URL with the Query string parameters missing.

https://na3.salesforce.com/a00/e?

 

Why do the query string parameters get dropped? What can I do about it.

 

Thank you in advance for your help.

 

 

  • September 19, 2010
  • Like
  • 0

We have a VisualForce Email Template where we want to display a
related list.  If it was a regular VisualForce page, we would include
an APEX extension and then call the class to populate a dataTable like
this:

 <apex:dataTable value="{!OppLines}" var="opp" border="0"
cellpadding="1" cellspacing="0">
    <apex:column ><apex:outputField
value="{!opp.PriceBookEntry.name}"/></apex:column>
    <apex:column ><apex:outputField value="{!opp.LSP__r.name}"/></apex:column>
    <apex:column ><apex:outputField value="{!opp.Quantity}"/></apex:column>
 </apex:dataTable>

 Which calls an APEX controller with this code:

 public OpportunityLineItem[] getOppLines() {
   OpportunityLineItem[] siItems = [SELECT PriceBookEntry.name,
LSP__r.name, Quantity
        FROM OpportunityLineItem
        Where OpportunityId = :ApexPages.currentPage().getParameters().get('Id')
        Order by PricebookEntry.name];
   return siItems;
 }

However, there is no way that we can see to attach the APEX controller
as an extension.  The only thing we could come up with is using a
component, and then referencing it in the VisualForce Email Template
like this:

<c:Opp_Lines_Component />

Unfortunately, the code in the APEX controller which pulls the ID from
the current VF Page doesn't work in an email template and so the
dataTable is always blank.

Is there any way to do what we are trying to do?

Can anyone point me in the right direction.

 

Background

 

I am working with a non-profit who need to record sightings of animals using GPS coordinates.  I have created a sightings object and have integrated a google map on the page using visualforce which pulls through the GPS data and adds a marker, code below.

 

I now want to show a map of all of the sightings for a particular animal. So I have created a parent object called wildlife which is simply the name of the animal and some other meta data.

 

Problem

 

The sightings object has a lookup to wildlife.  So if you were to lookup an animal on the wildlife object you would see a number of sightings.  I would like a map on the wildlife object that would show all of the related sightings as markers.

 

Code

 

This is the code for the single sightings map on the sightings object.

 

 

<apex:page standardController="Sighting__c">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<script src="http://maps.google.com/maps?file=api&amp;v=2.x&amp;key=ABQIAAAARQVi0nDV8_SJqZY8mkksjBQW4dj6q0E-oPzXa2fArCvhLhZBwBSQtm6TiVKHbHEvo8Jcr3_JN01Ubg" type="text/javascript"></script>
<script type="text/javascript">
var map = null;
var geocoder = null;
var address = "{!Sighting__c.Long__c}, {!Sighting__c.Lat__c}";
function initialize() {
if (GBrowserIsCompatible()) {
  map = new GMap2(document.getElementById("map_canvas"));
  map.addControl(new GSmallMapControl());
  map.setMapType(G_HYBRID_MAP);
  geocoder = new GClientGeocoder();
  geocoder.getLatLng(
    address,
    function(point) {
      if (!point) {
        document.getElementById("map_canvas").innerHTML = address + " not found";
      } else {
        map.setCenter(point, 16);
        var marker = new GMarker(point);        
        map.addOverlay(marker);
        marker.bindInfoWindowHtml("{!Sighting__c.Wildlife__r.Name__c} the {!Sighting__c.Wildlife__r.Type__c}<br /> Sighting Number: {!Sighting__c.Name}<br />{!Sighting__c.Date__c}");
      }
    }
  );
}
}
</script>
</head>
<body onload="initialize()" onunload="GUnload()">
<div id="map_canvas" style="width:100%;height:300px"></div>
</body>
</html>
</apex:page>

 

 

 

 

Ho can we associate(attach/detach) crm content  "ContentVersion" records to some custom object programatically?is there any method exposed to attach/detach in API?

Hi all;

I have several questions about Salesforce CRM Content.

1. Can I upload a file to Salesforce CRM Content by using Apex code? If so please tell how can I do that.

2. Can I display an image uploaded to Salesforce CRM Content on a visualforce page?

3. Is there a sObject which represents the Salesforce CRM Content, so that I can query data from that sObject?

 

If anybody knows an answer for at least one question please help me. If any question is not clear I'm ready to explain further. Thanks.

Is there any documentation or discussion on how to create a 'New Content'  button so we can add them to standard or custom object  page layouts?

 

My first solution was just to write a Visualforce page that redirects to a workspace based on some criteria of the retURL object. But then the user still has to click a second button (Contribute). 

 

Since $Action.Content.New is not valid, I assume this ability is not ready for primetime? Any ideas?

I'm having some difficulty finding the API capability that allows me to associate uploaded Content (inserted into ContentVersion) with any Custom Object without using the front end.  What object(s) store the relationship from any object to associated 'RelatedContent'?
  • November 24, 2009
  • Like
  • 0