So I'm trying to build some custom functionality revolving around opportunities and products.
What I have right now is a button on the OpportunityLineItem related list that is on our opportunities. When a user presses that button they are brought to a custom visualforce page with the same opp line items that are on the opportunity. From there, users can change a specific field on each of these that laucnhes some custom code.
What I really want though, is for only one selected item to be brought over to the visualforce page. I want to let users select that item with the action checkboxes on the opportunity line items.
Here's what I'm talking about:
So my question is: how can I tell what item is selected, and dictate my visualforce to only display that line item? I can't find anything in the API referncing these selection boxes, but I'm sure there must be something.
Here's the current state of my visualforce page:
<apex:page standardController="Opportunity" extensions="Opportunity_extendedController" >
<apex:pageBlock title="Line Items">
<apex:form >
<apex:commandButton action="{!exchangeInv}" value="Exchange Inventory" rerender="fake" />
<apex:commandButton action="{!cancel}" immediate="true" value="Cancel"/>
<apex:pageBlockTable value="{!Opportunity.opportunityLineItems}" var="oli">
<apex:column value="{!oli.Id}" />
<apex:column value="{!oli.Inventory__c}"/>
<apex:column value="{!oli.Name_Description__c}"/>
<apex:column headerValue="Inventory to exchange">
<apex:inputField value="{!oli.Inventory__c}" />
</apex:column>
</apex:pageBlockTable>
</apex:form>
</apex:pageBlock>
Best Answer
If you don't have any solution then I have a work around for this if you want to try. Below is the code for that
You can either use cookies to set value and then retrieve in your VF page or you can pass the value in URL. Below is the example of passing value to URL.
Visual force Page
Apex Class