• akze
  • NEWBIE
  • 5 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 4
    Replies

With the standard controller for Opportunity, I am trying to generate a list of line items (products) with custom formatting.  I am using the following:

 

    <apex:page renderAs="pdf" standardController="Opportunity">

    <h2>Items</h2>
    <apex:repeat value="{!Opportunity.OpportunityLineItems}" var="OLI">
    {!OLI.Product2.name}
    </apex:repeat>
    </apex:page>

 

However, Product2 seems to pretty clearly a standard field in the line item SObject.  Other fields like CreatedBy and Discount work fine.  Is there a gotcha for dealing with references?

 

Thanks,

Louis

I've got the following APEX code to display a dashboard page:

 

<apex:page >
        <apex:pageBlock >
            <apex:iframe src="/01Z200000011vtB?isdtp=nv" scrolling="true" height="1588px" width="100%"/>
        </apex:pageblock>    
</apex:page>

 Is it possible to use a case statement here to choose which ID is populated here?  I.e. I've got 8 dashboards and I was wondering if you could use the {!$User.FirstName} global variable within a case statement to choose which dashboard to display?

 

Thanks!

In Sales App, we have written Customized pages for Account View & Edit. Now we got requirement to redirect page to Standard Account edit page based on record type. I mean if Record type is "ABC" goto Account_EDIT_VF page else goto Standard Salesforce Account Edit page.

I have tried below changes, but I am breaking existing logic. For both record types, page is redirecting to Standard Edit page. Please suggest corrections...Thanks for your time.

 

PAGE:

<apex:page standardController="Account" id="AccPage" showHeader="true" tabStyle="account" extensions="AcctEditController" action="{!nullvalue(null, urlFor($Action.Account.edit, Account.id,[retURL=URLFOR($Action.Account.view, Account.id,null,true)], true))}"> <style>

 

 

Controller:

 

if(rectype.name=='ABC')
{
return null; 
} else {
PageReference newPage1 = new PageReference('/' + recordId + '/e');
newPage1.setRedirect(true);
newPage1.getParameters().put('nooverride', '1');
return newpage1;
}

 

Hi All,

 

I am getting Attempt to de-reference a null object while opening visual force template.

 

Here is the code:

 


Template Code :
======================

<messaging:emailTemplate subject="New Template" recipientType="User" relatedToType="Custom__object__c">
    <messaging:plainTextEmailBody >
      <c:Test_EmailTemplatecomponent AccId="{!relatedTo.ID}"/>   
    </messaging:plainTextEmailBody>
</messaging:emailTemplate>


Component :
===============

<apex:component controller="Test_EmailTemplatecontroller" access="global">
     <apex:attribute name="AccId" description="My Account ID." type="String" required="required" assignTo="{!accountId}"/>
     <h1>Congratulations</h1>
     <p>{!accountName}</p>
</apex:component>

Controller:
=============

public without sharing class Test_EmailTemplatecontroller
{
     private String cAccountId;
     private Custom__object__c cAccount;

     public String getAccountId()
     {
System.debug('####################Account ID : ' + cAccountId);
          return cAccountId;
     }

     public void setAccountId(String id)
     {
System.debug('###################################### id: ' + id);
          cAccountId = id;
          initializeAccount();
     }

     public String getAccountName()
     {
System.debug('#####################################name: ' + cAccount.Name);
          return cAccount.Name;
     }

     private void initializeAccount()
     {
System.debug('################################initializeAccount');
          if(cAccountId != null) {
               Custom__object__c cAccount = [SELECT Name, Id FROM Custom__object__c WHERE ID = :cAccountId];
          }
     }
}

                 
>> I am not getting any error When I comment out getAccountName method but I want to dispay the account name here

 

 Can any one help me to how to resolve this?

 

Thanks,
                

 

  • April 13, 2013
  • Like
  • 0