• watanabe2
  • NEWBIE
  • 10 Points
  • Member since 2013

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

I have a controller which creates a wrapper class and a list of this wrapper class.

 

I have a Visualforce page which uses the standard opportunity controller with the controller containing the wrapper class as an extension. The VF page must use the standard opportunity controller because it is being embedded on the opportunity page layout.

 

I want the Visualforce page to iterate over the list of the wrapper class within a pageBlockTable.

 

However, I get this error.

Error: Unknown property 'OpportunityStandardController.AttachmentWOwnerProfile'

 

How do I let the pageBlockTable know that the list is contained within the extension class?

I've built a simple two screen Visualforce sequence on an opportunity.

The first Visualforce page is used to upload documents to the opportunity.

 

This is the second VF page, used to update a field on the opportunity.

<apex:page standardController="opportunity" extensions="Digilant_UpdateRating" showHeader="true" sidebar="true">
    <apex:form >
    
    <apex:pageBlock >
        <apex:pageBlockButtons >
            <apex:commandButton value="Notify Sales" Action="{!saveRating}"/>
            <apex:commandButton value="Cancel" Action="{!cancel}"/>
            </apex:pageBlockButtons>
        <apex:pageBlockSection title="Select Rating" columns="1">    
            <apex:inputField value="{!opportunity.Rating__c}"/>
        </apex:pageBlockSection>
    </apex:pageBlock>
    
    </apex:form>
</apex:page>

 

The controller should retrieve set the recId property from a URL parameter, use this to execute a SOQL query, and then update the retrieved record. However, the value is not getting pushed to the record and the update is failing. No error message is being generated.

 

This is the controller code.

public class Digilant_UpdateRating
{
    public Id recId{get;set;}
    public PageReference pr{get;set;}
    public ApexPages.StandardController ctrl;
    public opportunity opp;

    public Digilant_UpdateRating(ApexPages.StandardController controller) {
        ctrl = controller;
        recId = ApexPages.CurrentPage().getParameters().get('opportunityid');
        this.opp = [SELECT Id, rating__c FROM Opportunity WHERE Id =: recId];
        System.debug('opportunity is' + opp.id);
    }
    
    public pageReference saveRating()
    {
        update opp;
        pr = new PageReference('/'+recId);
        pr.setRedirect(true);
        return pr;
    }
}

 

 

I have a Visualforce template designed to pull a list of leads belonging to the recipient of the email. I'm using a component inside of the VF template to display the leads.

 

It seems the user Id is being lost somewhere in the transition from the VF page to the controller. Consequently I'm getting no records back for display by the component.

 

Email template:

<messaging:emailTemplate subject="Reminder: Inactive Opportunity Reminder for: {!Relatedto.Name}" recipientType="User"
relatedToType="User">
    
    <messaging:htmlEmailBody >
        <p>The following leads have not yet been updated:</p>
        <c:Digilant_InactiveLeads ToID="{!RelatedTo.ID}" />
        
        <p>To update these leads, click on the "Lead Status" field located in the upper right on the lead page layout.</p>
    </messaging:htmlEmailBody>
</messaging:emailTemplate>

 Component:

<apex:component controller="Digilant_findInactiveLeads" access="global">
    <apex:attribute name="ToID" type="ID" description="the lead owner ID" assignTo="{!salesRepID}"/>
    
    <apex:dataTable value="{!InactiveLeads}" var="i_lead">
        <apex:column >
            <apex:facet name="header">Name</apex:facet>
            {!i_lead.Name}
        </apex:column>
        
        <apex:column >
            <apex:facet name="header">Source</apex:facet>
            {!i_lead.LeadSource}
        </apex:column>
        
         <apex:column >
            <apex:facet name="header">Created Date</apex:facet>
            {!i_lead.CreatedDate}
        </apex:column>
    </apex:dataTable>

</apex:component>

 Controller:

public class Digilant_findInactiveLeads {
    public List<Lead> leads {get; set;}
    public ID salesRepID {get; set;}

    public Digilant_findInactiveLeads() {
       leads = [select Name, LeadSource, CreatedDate from Lead from Lead where status = 'Open' AND ownerId =: salesRepID];
    }

    public List<Lead> getInactiveLeads() {
        return leads;
    }
}

 

I've built a simple two screen Visualforce sequence on an opportunity.

The first Visualforce page is used to upload documents to the opportunity.

 

This is the second VF page, used to update a field on the opportunity.

<apex:page standardController="opportunity" extensions="Digilant_UpdateRating" showHeader="true" sidebar="true">
    <apex:form >
    
    <apex:pageBlock >
        <apex:pageBlockButtons >
            <apex:commandButton value="Notify Sales" Action="{!saveRating}"/>
            <apex:commandButton value="Cancel" Action="{!cancel}"/>
            </apex:pageBlockButtons>
        <apex:pageBlockSection title="Select Rating" columns="1">    
            <apex:inputField value="{!opportunity.Rating__c}"/>
        </apex:pageBlockSection>
    </apex:pageBlock>
    
    </apex:form>
</apex:page>

 

The controller should retrieve set the recId property from a URL parameter, use this to execute a SOQL query, and then update the retrieved record. However, the value is not getting pushed to the record and the update is failing. No error message is being generated.

 

This is the controller code.

public class Digilant_UpdateRating
{
    public Id recId{get;set;}
    public PageReference pr{get;set;}
    public ApexPages.StandardController ctrl;
    public opportunity opp;

    public Digilant_UpdateRating(ApexPages.StandardController controller) {
        ctrl = controller;
        recId = ApexPages.CurrentPage().getParameters().get('opportunityid');
        this.opp = [SELECT Id, rating__c FROM Opportunity WHERE Id =: recId];
        System.debug('opportunity is' + opp.id);
    }
    
    public pageReference saveRating()
    {
        update opp;
        pr = new PageReference('/'+recId);
        pr.setRedirect(true);
        return pr;
    }
}

 

 

hi guys

can anyone tell me 

what is recursive trigger with perfect example pls

Hi,

 

    Please Let me know how to redirect to a page from javascript. This javascript is being called if any event occurs.

 

I was trying with

 

window.location('/apex/Pagename');

 

But it is not working.

 

Please help me...........

 

Regards,

 

shra1