You need to sign in to do that
Don't have an account?
Waqas Ali
Show Contracts in VF and change status in VF through Dropdown menu
I have button in opportunity page , When that button is pressed, I want to show my pending contracts in Visual force page and want o Expire or Laspe through VF page. Here is my class
Here is my VF page.
public class myclass { String theId = ApexPages.currentPage().getParameters().get('id'); public List<WrapperSObject> records {get; set;} public Contract con {get; set;} public myclass(ApexPages.StandardController stdController) { this.o = (Opportunity)stdController.getRecord(); } public PageReference autoRun() { records = new List<WrapperSObject>(); for (Contract c : [select Name, AccountId, StartDate, Status, ContractNumber from Contract where Status='Pending']) { records.add(new WrapperSObject(c)); records.add(new WrapperSObject(getOptions(), '--None--')); } return null; } public class WrapperSObject { public Contract con {get; set;} public List < SelectOption > options {get; set;} public String selectedValue {get; set;} public WrapperSObject( List < SelectOption > options, String selectedValue) { this.options = options; this.selectedValue = selectedValue; } public WrapperSObject(Contract c) { con=c; } } public List < SelectOption > getOptions() { List<SelectOption> options = new List<SelectOption>(); options.add(new SelectOption('Expired','Expired')); options.add(new SelectOption('LAPSE','Lapse')); return options; } }
Here is my VF page.
<apex:page standardController="Opportunity" extensions="myclass" action="{!autoRun}"> <apex:form > <apex:pageBlock title="My Pending Contracts"> <apex:pageBlockTable value="{!records}" var="wrapper"> <apex:column > <apex:facet name="header">Contract Number</apex:facet> <apex:outputText value="{!wrapper.con.ContractNumber}"/> </apex:column> <apex:column > <apex:facet name="header">Contract Name</apex:facet> <apex:outputText value="{!wrapper.con.Status}"/> </apex:column> <apex:column > <apex:facet name="header">Change Status</apex:facet> <apex:selectList value="{!wrapper.selectedValue}" size="1" > <apex:selectOptions value="{!wrapper.options}" /> </apex:selectList> </apex:column> </apex:pageBlockTable> </apex:pageBlock> </apex:form> </apex:page>
Why this small blank Dropdown menu is showing ?
How to fix this ?
Now how to change the status of these contracts ? I mean how to return the value "Expired or Lapse" and update crosponding Contract ?
Guys ay help ?
Try below code and let if know if it works,
Best Regards,
-Vivek
Try below code , it should work and let me know.
Best Regards,
-Vivek
Argument 2 cannot be null