• pat!
  • NEWBIE
  • 0 Points
  • Member since 2011

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

How can I determine the current Application Name?

 

(e.g. Is it Sales? Call Center? Custom Application?)

 

Thanks!

Pat

  • July 04, 2011
  • Like
  • 0

Hi!

 

I need some help on how to fix this Visualforce Error Message. I want to display the Open Activities and Activity History related list for a Custom Object. In its standard page, by default, this two related list is displayed but when I try to override the view page with a custom visualforce page only the custom child object related list shows.

 

Here's my code:

 

<apex:page StandardController="Object__c" extensions="ObjectExtension" showHeader="true" sidebar="true" >

    

    <apex:detail />    


    <apex:relatedList list="Object_Child__r"/>


    <apex:relatedList list="OpenActivities" />
    <apex:relatedList list="ActivityHistories"/>

</apex:page>

 

Is it something about salesforce restrictions? Like, Open Activities and Activity History were standard objects and cannot be a child of a custom object? Is there anyway I can do this right? I really need help T.T

 

Thanks!

 

Best Regards,

Pat

  • June 30, 2011
  • Like
  • 0

Do Visualforce pages that use a standard controller have access to page layout metadata?  If so how?  To give an example, here's a simple Account page:

 

<apex:page standardController="Account" showHeader="true" tabStyle="account">

<apex:detail relatedList="false" title="true"/>

<apex:relatedList subject="{!account}" list="Contacts" />

<apex:relatedList subject="{!account}" list="Opportunities" />

<apex:relatedList subject="{!account}" list="OpenActivities" />

<apex:relatedList subject="{!account}" list="NotesAndAttachments" />

</apex:page>

 

The apex:page component will only show fields that are in the page layout, so that works fine.  However the related lists always show up.  Say one of these related lists are not added to the normal Account page layout, is there any way that the Visualforce page could be aware of that?  Thanks for your help.

  • October 03, 2011
  • Like
  • 0

So ... when I went to training about 6 months ago, they told me to make sure I set myself up for "little successes".  Now, I know why ... because I have already run into a stickler on my first piece of code that is beyond frustrating!!

 

I've created a custom object, a controller extension and two VF pages, which will serve as the beginning of a wizard.  I want to be able to choose the Account Name in the first page of the wizard, and then have that Account Name and the corresponding Global Region (custom) field from the Account object display on the 2nd page of the wizard.   But no matter what I do I can't get the Account name to move from page 1 to page 2. 

 

Here's the code I have so far ... I'm sure it's something simple ...

 

Thanks in advance for your help!!  I'm going to post this in both the VF discussion forum and the Apex one, just in case ....

 

Controller Extension:

public with sharing class ARWizard {

// First declare all properties that will be used to maintain the state of the wizard.
// Search results are not transient in case the user accidentally selects the wrong one and wants to go back.
    
// First property is the standard controller, called controller,
// so that in read mode it will work as object is built.
     public ApexPages.standardController controller {get; set;}
     
// Next is an Assistance Request variable called assistanceRequest to insert when we're done
    public Assistance_Request__c assistanceRequest { get; set; }
     
// Next property is the Account, referenced by the variable called account with default getter/setter
    public Account account {get;set;}
    
// Next property is the Account ID called "accountId" with default getter/setter
    public ID accountID {get;set;}
    
// Now I have to build a constructor to create the Assistance Request 
    public ARWizard (ApexPages.standardController controller) {
      
  }   
  

// The next 2 methods control navigation through the wizard. 
// Each returns a PageReference for one of the 2 pages in the wizard.
// Note that the redirect attribute does not need to be set on the PageReference 
// because the URL does not need to change when users move from page to page.

// First is a method called "step1" to return the page reference for the ARStep1 page
    public PageReference step1() {
        return Page.arStep1;
    }

// Next is a method called "step2" to get the account and then return the page reference for the ARStep2 page
     public PageReference step2() {
        try {
        	account = [SELECT Id,Name,Global_Region__c
        	           FROM Account
        	           WHERE Id =: assistanceRequest.Account_Name__c];
           }
        catch(Exception e)  {
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,e.getMessage()));
    }
    return Page.arStep2;
     }


       public PageReference save() {
      	     	System.debug('&&&&&&& Account=' + account);
        	try{
        		insert assistanceRequest;
        	} catch (System.DmlException e) {
				ApexPages.addMessages(e);
				return null;
    		}
        	controller = new ApexPages.standardController(assistanceRequest);
        	return controller.view();
        }
}

 

Page 1:

<apex:page standardController="Assistance_Request__c" extensions="ARWizard" tabStyle="Assistance_Request__c">
  
    <script>
    function confirmCancel(){
    var isCancel = confirm("Are you sure you wish to cancel and exit this Assistance Request?");
    if (isCancel) return true;
    return false;
    }
    </script>
    
    <apex:sectionHeader title="Assistance Request" subtitle="Step 1 of X"/>
  <apex:form > 
      <apex:pageBlock id="theBlock" title="Assistance Request Creation" mode="edit">
          <apex:pageBlockButtons >
              <apex:commandButton action="{!step2}" value="Next"/>
              <apex:commandButton action="{!cancel}" value="Cancel" onclick="return confirmCancel()" immediate="true" style="margin-left: 2em"/>
          </apex:pageBlockButtons>
          <apex:pageBlockSection title="Account Information" columns="1">
              <apex:inputField value="{!AssistanceRequest.Account_Name__c}"/>
          </apex:pageBlockSection>
      </apex:pageBlock> 
  </apex:form>
</apex:page>

 

Page 2:

<apex:page standardController="Assistance_Request__c" extensions="ARWizard" tabStyle="Assistance_Request__c">
  
        <script>
    function confirmCancel(){
    var isCancel = confirm("Are you sure you wish to cancel and exit this Assistance Request?");
    if (isCancel) return true;
    return false;
    }
    </script>
    
    <apex:sectionHeader title="Assistance Request" subtitle="Step 2 of X"/>
    
  <apex:form > 
      <apex:pageBlock id="theBlock" title="Assistance Request Creation - Request Details" mode="edit">
          <apex:pageBlockButtons >
              <apex:commandButton action="{!step1}" value="Previous"/>
              <apex:commandButton action="{!cancel}" value="Cancel" onclick="return confirmCancel()" immediate="true" style="margin-left: 2em"/>
          </apex:pageBlockButtons>
          <apex:pageBlockSection title="Account Information" columns="2">
              <apex:outputField value="{!Assistance_Request__c.Account_Name__c}"/>
              <apex:outputField value="{!Assistance_Request__c.Global_Region__c}"/>
          </apex:pageBlockSection>
          
           <apex:pageBlockSection title="Request Information" columns="2">
              This is where the request product, category and action will go.
          </apex:pageBlockSection>
      </apex:pageBlock> 
  </apex:form>
</apex:page>

 

Gosh guys/gals... sometimes I just don't get it...  I've seen scores of other post with this same issues and feel like I've tried most of them and still can't resolve this error.  I must be missing something but I'm new enough to not know what it is.  Thanks for any help.

 

error: Unknown constructor 'conQuickEmail.conQuickEmail(ApexPages.StandardController controller)'

 

Here's my VF page's controller line:

<apex:page standardController="lead" extensions="conQuickEmail" id="page" tabStyle="lead">

 

Here's my latest try for the controller:

public with sharing class conQuickEmail {

private final ApexPages.StandardSetController stdController;

public conQuickEmail(ApexPages.StandardSetController controller) {
	this.stdController = (Lead)stdcontroller.getRecord();              //  <-- this is line 23

// rest of the code
}

 

Here's my test class which gives me this error:  error: Variable does not exist: ApexPages.StandardSetController

private static testmethod void  quickEmailTests() {
	Lead l = [select id from Lead where EmailBouncedDate = null and email != null limit 1];
	PageReference testPage = Page.Quick_Email;
	testPage.getParameters().put('rec',l.id);
	testPage.getParameters().put('retURL','/home/home.jsp');
	Test.setCurrentPage(testPage);
	
	conQuickEmail controller = new conQuickEmail(ApexPages.StandardSetController(l));
	controller.send();
  
	Lead l2 = [select id from Lead where EmailBouncedDate = null and email != null limit 1];
	testPage = Page.Quick_Email;
	testPage.getParameters().put('rec',l2.id);
	testPage.getParameters().put('retURL','/home/home.jsp');
	Test.setCurrentPage(testPage);
	controller = new conQuickEmail(ApexPages.StandardSetController(l));
	controller.send();
	controller.cancel();

 

 

Hi!

 

I need some help on how to fix this Visualforce Error Message. I want to display the Open Activities and Activity History related list for a Custom Object. In its standard page, by default, this two related list is displayed but when I try to override the view page with a custom visualforce page only the custom child object related list shows.

 

Here's my code:

 

<apex:page StandardController="Object__c" extensions="ObjectExtension" showHeader="true" sidebar="true" >

    

    <apex:detail />    


    <apex:relatedList list="Object_Child__r"/>


    <apex:relatedList list="OpenActivities" />
    <apex:relatedList list="ActivityHistories"/>

</apex:page>

 

Is it something about salesforce restrictions? Like, Open Activities and Activity History were standard objects and cannot be a child of a custom object? Is there anyway I can do this right? I really need help T.T

 

Thanks!

 

Best Regards,

Pat

  • June 30, 2011
  • Like
  • 0