You need to sign in to do that
Don't have an account?
Aaron Persich 9
Visualforce Mass Edit Opp help
Hello,
I am working on building a “Mass Edit Opps” visualforce button on the opportunity list views and I need some help with the visualforce page. The page allows the user to edit multiple Opportunity fields and one Account field. The opportunity field updates work but the one Account picklist field labeled “Account Rank” does not make the update on the account. The field shows on the page but will not make the update when I hit save.
How can I get this to work? Any help is much appreciated
Here is the visualforce code
<apex:page standardController="Opportunity" recordSetVar="unused" sidebar="false">
<apex:includeScript value="{!$Resource.UtilJS}" />
<apex:form >
<apex:pageBlock >
<apex:pageMessages />
<apex:pageBlock >
Note: All modifications made on the page will be lost if Return button is clicked without clicking the Save button first.
</apex:pageBlock>
<apex:pageBlockButtons >
<apex:commandButton value="Save" action="{!save}"/>
<apex:commandButton value="Return" action="{!cancel}"/>
</apex:pageBlockButtons>
<apex:pageBlockTable value="{!selected}" var="opp" id="table">
<apex:column headerValue="Name">
<apex:inputField value="{!opp.name}"/>
</apex:column>
<apex:column headerValue="Account Rank">
<apex:inputField value="{!opp.account.Account_Rank__c}"/>
</apex:column>
<apex:column headerValue="Channel Partner">
<apex:inputField value="{!opp.Channel_Partner__c}"/>
</apex:column>
<apex:column headerValue="Project Name">
<apex:inputField value="{!opp.Project_Name__c}"/>
</apex:column>
<apex:column headerValue="Evaluation Period - Start Date">
<apex:inputField value="{!opp.Evaluation_Period_Start_Date__c}"/>
</apex:column>
<apex:column headerValue="Success Criteria for Evaluation">
<apex:inputField value="{!opp.Success_Criteria_for_Evaluation__c}"/>
</apex:column>
<apex:column headerValue="Customer Pain Points">
<apex:inputField value="{!opp.Customer_Pain_Points__c}"/>
</apex:column>
<apex:column headerValue="Amount">
<apex:inputField required="true" value="{!opp.amount}"/>
</apex:column>
<apex:column headerValue="Budget">
<apex:inputField value="{!opp.Budget__c}"/>
</apex:column>
<apex:column headerValue="Close Date">
<apex:inputField value="{!opp.closeDate}"/>
</apex:column>
<apex:column headerValue="Probability">
<apex:inputField value="{!opp.Probability}"/>
</apex:column>
<apex:column headerValue="Weighted Revenue">
<apex:inputField value="{!opp.Weighted_Revenue__c}"/>
</apex:column>
<apex:column headerValue="Champion">
<apex:inputField value="{!opp.Champion__c}"/>
</apex:column>
<apex:column headerValue="Technical Issues">
<apex:inputField value="{!opp.Technical_Issues__c}"/>
</apex:column>
<apex:column headerValue="Business Issues">
<apex:inputField value="{!opp.Business_Issues__c}"/>
</apex:column>
<apex:column headerValue="Other Comments or Obstacles">
<apex:inputField value="{!opp.Other_Comments_or_Obstacles__c}"/>
</apex:column>
<apex:column headerValue="Required Resources">
<apex:inputField value="{!opp.Required_Resources__c}"/>
</apex:column>
<apex:column headerValue="SE Comments">
<apex:inputField value="{!opp.SE_Comments__c}"/>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
I am working on building a “Mass Edit Opps” visualforce button on the opportunity list views and I need some help with the visualforce page. The page allows the user to edit multiple Opportunity fields and one Account field. The opportunity field updates work but the one Account picklist field labeled “Account Rank” does not make the update on the account. The field shows on the page but will not make the update when I hit save.
How can I get this to work? Any help is much appreciated
Here is the visualforce code
<apex:page standardController="Opportunity" recordSetVar="unused" sidebar="false">
<apex:includeScript value="{!$Resource.UtilJS}" />
<apex:form >
<apex:pageBlock >
<apex:pageMessages />
<apex:pageBlock >
Note: All modifications made on the page will be lost if Return button is clicked without clicking the Save button first.
</apex:pageBlock>
<apex:pageBlockButtons >
<apex:commandButton value="Save" action="{!save}"/>
<apex:commandButton value="Return" action="{!cancel}"/>
</apex:pageBlockButtons>
<apex:pageBlockTable value="{!selected}" var="opp" id="table">
<apex:column headerValue="Name">
<apex:inputField value="{!opp.name}"/>
</apex:column>
<apex:column headerValue="Account Rank">
<apex:inputField value="{!opp.account.Account_Rank__c}"/>
</apex:column>
<apex:column headerValue="Channel Partner">
<apex:inputField value="{!opp.Channel_Partner__c}"/>
</apex:column>
<apex:column headerValue="Project Name">
<apex:inputField value="{!opp.Project_Name__c}"/>
</apex:column>
<apex:column headerValue="Evaluation Period - Start Date">
<apex:inputField value="{!opp.Evaluation_Period_Start_Date__c}"/>
</apex:column>
<apex:column headerValue="Success Criteria for Evaluation">
<apex:inputField value="{!opp.Success_Criteria_for_Evaluation__c}"/>
</apex:column>
<apex:column headerValue="Customer Pain Points">
<apex:inputField value="{!opp.Customer_Pain_Points__c}"/>
</apex:column>
<apex:column headerValue="Amount">
<apex:inputField required="true" value="{!opp.amount}"/>
</apex:column>
<apex:column headerValue="Budget">
<apex:inputField value="{!opp.Budget__c}"/>
</apex:column>
<apex:column headerValue="Close Date">
<apex:inputField value="{!opp.closeDate}"/>
</apex:column>
<apex:column headerValue="Probability">
<apex:inputField value="{!opp.Probability}"/>
</apex:column>
<apex:column headerValue="Weighted Revenue">
<apex:inputField value="{!opp.Weighted_Revenue__c}"/>
</apex:column>
<apex:column headerValue="Champion">
<apex:inputField value="{!opp.Champion__c}"/>
</apex:column>
<apex:column headerValue="Technical Issues">
<apex:inputField value="{!opp.Technical_Issues__c}"/>
</apex:column>
<apex:column headerValue="Business Issues">
<apex:inputField value="{!opp.Business_Issues__c}"/>
</apex:column>
<apex:column headerValue="Other Comments or Obstacles">
<apex:inputField value="{!opp.Other_Comments_or_Obstacles__c}"/>
</apex:column>
<apex:column headerValue="Required Resources">
<apex:inputField value="{!opp.Required_Resources__c}"/>
</apex:column>
<apex:column headerValue="SE Comments">
<apex:inputField value="{!opp.SE_Comments__c}"/>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
Standard opportuntiy save button will not save account record associated with opportunity you need to created a extension, you can keep all the code as it is and create a new class set as extension on current VF and in extension you have to explicitly save Account record
Page code will look like this
Extension class will look like this:
In case Account is not updated then create a String variable in Apex class and add a apex select option instead of <apex:inputField value="{!opp.account.Account_Rank__c}"/> . You also need to get the picklist values
<apex:actionSupport event="onchange" action="{!accountRank}" rerender="cases_table"/>
<apex:selectOptions value="{!items}"/>
</apex:selectList>
Thanks
All Answers
Standard opportuntiy save button will not save account record associated with opportunity you need to created a extension, you can keep all the code as it is and create a new class set as extension on current VF and in extension you have to explicitly save Account record
Page code will look like this
Extension class will look like this:
In case Account is not updated then create a String variable in Apex class and add a apex select option instead of <apex:inputField value="{!opp.account.Account_Rank__c}"/> . You also need to get the picklist values
<apex:actionSupport event="onchange" action="{!accountRank}" rerender="cases_table"/>
<apex:selectOptions value="{!items}"/>
</apex:selectList>
Thanks
Error: Compile Error: expecting a semi-colon, found 'udpate' at line 21 column 4
You can see at the line number mentioned in the error semicolon is missing after update opp, also I just wrote the class directly here so this is not compiled you need to fix such minor issues
I tried to add the semicolon after the update opp and I still get the same error. I have no idea how to code and I am not sure what I am doing here
udpate opp;
udpate new Account(Id = opp.AccountId , Account_Rank__c = opp.Account.Account_Rank__c );
Error: Compile Error: expecting a semi-colon, found 'new' at line 21 column 11
Replace line with below code:
udpate new Account(Id = opp.AccountId , Account_Rank__c = opp.Account.Account_Rank__c );
New code
Account acc = new Account(Id = opp.AccountId);
acc.Account_Rank__c = opp.Account.Account_Rank__c;
update acc;
I got the controller to save but when I try to add it to the visualforce page I get the below error.
Error: Unsupported attribute extension in <apex:page> in MassEditOpp2 at line 1 column 116
<apex:page standardController="Opportunity" extension="OpportunityExtension" recordSetVar="unused" sidebar="false">
<apex:includeScript value="{!$Resource.UtilJS}" />
<apex:form >
<apex:pageBlock >
<apex:pageMessages />
<apex:pageBlock >
Note: All modifications made on the page will be lost if Return button is clicked without clicking the Save button first.
</apex:pageBlock>
<apex:pageBlockButtons >
<apex:commandButton value="Save" action="{!saverecords}"/>
<apex:commandButton value="Return" action="{!cancel}"/>
</apex:pageBlockButtons>
<apex:pageBlockTable value="{!selected}" var="opp" id="table">
<apex:column headerValue="Name">
<apex:inputField value="{!opp.name}"/>
</apex:column>
<apex:column headerValue="Account Rank">
<apex:inputField value="{!opp.account.Account_Rank__c}"/>
</apex:column>
<apex:column headerValue="Channel Partner">
<apex:inputField value="{!opp.Channel_Partner__c}"/>
</apex:column>
<apex:column headerValue="Project Name">
<apex:inputField value="{!opp.Project_Name__c}"/>
</apex:column>
<apex:column headerValue="Evaluation Period - Start Date">
<apex:inputField value="{!opp.Evaluation_Period_Start_Date__c}"/>
</apex:column>
<apex:column headerValue="Success Criteria for Evaluation">
<apex:inputField value="{!opp.Success_Criteria_for_Evaluation__c}"/>
</apex:column>
<apex:column headerValue="Customer Pain Points">
<apex:inputField value="{!opp.Customer_Pain_Points__c}"/>
</apex:column>
<apex:column headerValue="Amount">
<apex:inputField required="true" value="{!opp.amount}"/>
</apex:column>
<apex:column headerValue="Budget">
<apex:inputField value="{!opp.Budget__c}"/>
</apex:column>
<apex:column headerValue="Close Date">
<apex:inputField value="{!opp.closeDate}"/>
</apex:column>
<apex:column headerValue="Probability">
<apex:inputField value="{!opp.Probability}"/>
</apex:column>
<apex:column headerValue="Weighted Revenue">
<apex:inputField value="{!opp.Weighted_Revenue__c}"/>
</apex:column>
<apex:column headerValue="Champion">
<apex:inputField value="{!opp.Champion__c}"/>
</apex:column>
<apex:column headerValue="Technical Issues">
<apex:inputField value="{!opp.Technical_Issues__c}"/>
</apex:column>
<apex:column headerValue="Business Issues">
<apex:inputField value="{!opp.Business_Issues__c}"/>
</apex:column>
<apex:column headerValue="Other Comments or Obstacles">
<apex:inputField value="{!opp.Other_Comments_or_Obstacles__c}"/>
</apex:column>
<apex:column headerValue="Required Resources">
<apex:inputField value="{!opp.Required_Resources__c}"/>
</apex:column>
<apex:column headerValue="SE Comments">
<apex:inputField value="{!opp.SE_Comments__c}"/>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>