You need to sign in to do that
Don't have an account?
mramaprasad.ax1826
Customizing opportunity product detail page
I have added 3 products to an opportunity.When I try to edit the product (opportunity product detail), I need to show differnt fields based on the the the products I am editing. Since I can not create record types for opportunity product I want to write a visualforce page.
Can I achive this by creating a custom class and a visualforce page?
Can I achive this by creating a custom class and a visualforce page?
I am new to developemnt in SF. I am not sure how the whole thing works.
Thanks
Malini
I understand your requirement, I'm just not sure there is a good way to accomplish it. You can add a custom button to the related list, but it wouldn't be for a specific item in the list. For example, you could have a button on the Products related list but you can't have a separate button next to each item in the Products related list that will let you navigate to a VF page specifically for that item.
Depending on what fields you want to add for the type of product you could just include them all in one layout and separate product specific fields with labels that notify the user that the field is only relevant for that particular product.
Alternatively you could add a custom button or link to the Opportunity Product Detail Layout that might be labeled something like "More Product Specific Details" where it could navigate to a VF page specifically for that Opportunity Product. It's not ideal in terms of usability flow but it kind of depends which you prefer : all of the fields on one layout or having the user click another button to go to another VF page.
I was thinking
1) have a VF page which lists fields that are common to all produts.
2) Have If condition to check the product type and display specific fields.
3) have the button next to each product name which takes you to the VF page that I created. Or I like your solution of adding it on the detail page as well.
But not sure how to go about doing it oe if it is even possible?
1.) Finding a way to link the VF page to a single Product
2.) Building the VF page to dynamically show fields based on the specific Product
# 2 is easy, just use the "rendered" attribute of the pageblock element refer to some variables in your controller. For example, you'd have boolean variables such as isProductA, isProductB and so on which are calculated in the Apex controller. Then you just add all of your fields to the VF page and for the dynamic fields include the rendered attribute (i.e. rendered="{!isProductA}" would only display that element if isProductA is true)
#1 is the sticky part because you'll have to do something sub optimal to make it work. The best way I can think of is my earlier suggestion of putting the custom link/button on the Opportunity Product Detail page layout. The button would navigate to the VF page and can pass the appropriate variable values in the URL which the apex controller can then parse to determine which sections of the VF page will render.
Depending on what fields you want to add for the type of product you could just include them all in one layout and separate product specific fields with labels that notify the user that the field is only relevant for that particular product.
How will add the button so that it opens my VF page?
Currently (out of the box) when you click on the product name, it takes us to the product detail page. Can we not change so that we go to VF page?
You should be able to override the View function for the Opportunity Product object with a VF page. That solves the second half of the problem
I created a class:
public class overrideCon{
public void save() {
}
}
I created a VF page (trainingProductPage):
<apex:page controller="overrideCon" action="{!save}"> <apex:detail /> </apex:page>
I am not able to see the page I created when trying to override View button under opportunity products. Any ideas what I am going wrong?
Go to Setup | Administration Setup | Manage Users | Profiles
Click on the profile label
Scroll to the bottom and click edit for "Enabled Visualforce Page Access".
Add the visual force pages
Click save
<apex:page standardController="OpportunityLineItem">
<apex:pageBlock id="xxxpb1">
default product field
<apex:pageBlockSection id="xxxpbs2" rendered="{!Product2Id== 'B01t17000000BmMT'}">
product A fields
</apex:pageBlockSection>
</apex:PageBlock>
</apex:page>
I get the following error while saving.
Error: Unknown property 'OpportunityLineItemStandardController.Product2Id'
What am I doing wrong?
I got that working. Here is what I have on my page:
<apex:page standardController="OpportunityLineItem" extensions="overrideCon" sidebar="true" showHeader="true">
<apex:form >
<input value=" Save " class="btn" title="Save" name="save" type="submit"/>
<input value="Cancel" class="btn" title="Cancel" name="cancel" type="submit"/>
<apex:pageBlock id="xxxpb1">
Opportunity: {!opp.name}<br></br>
Product: {!pro.name}
Quantity: <apex:inputField value="{!OpportunityLineItem.Quantity}"/>
<apex:pageBlockSection id="xxxpbs2" rendered="{!OpportunityLineItem.Product2Id=='01t17000000BmMdAAK'}">
product 1 fields
</apex:pageBlockSection>
<apex:pageBlockSection id="xxxpbs3" rendered="{!OpportunityLineItem.Product2Id=='01t17000000BmMTAA0'}">
product 2 fields
</apex:pageBlockSection>
<apex:pageBlockSection id="xxxpbs4" rendered="{!OpportunityLineItem.Product2Id=='01t17000000BX9SAAW'}">
product 3 fields
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
How can I get the save and cancel button to save the changes?
<apex:commandButton value="Save" action="{!save}"/>
<apex:commandButton value="Cancel" action="{!cancel}"/>
worked.