• watanabe2
  • NEWBIE
  • 10 Points
  • Member since 2013

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

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