I need to programmatically select the fields or values that are shown when I add a line item to an opportunity.
I.E. If I add a new item of type "A", in the mini page layout, I need to show Fields "X", "Y", "Z". If I add a new item of type "B", in the mini page layout, I need 开发者_高级运维to show fields "X", "Z".
I'm kind of Salesforce newbie. I don't know where to even start. Just a link to the area of documentation that would explain this would be very helpful.
So if I understand correctly, you want the line item related list to show different fields on a row according to a certain field on the line item?
I can't think of anyway to do this with standard functionality, leaving two options I can think of:
Create a custom visualforce page and generated the related list yourself, you can then display different details for each row as it'll be 100% custom — since you're new to the platform I doubt this is will be a particularly viable option.
Use formula fields on the line item to display different values based on the type of a line, then expose these formula fields on the related list.
For example, Forumla_Field_1__c might will use the CASE()
function to switch it's output based on one of the fields:
CASE(Type__c, 'A', Field_X__c, 'B' Field_Y__c);
Of course this won't allow you to display a different number of fields on each row, but it will let you see the values you want.
If I've misunderstood, and all line items on a given opportunity will be of the same type, then you'll want to use record types on the opportunity itself, then you can have a different page layout for each record type, and as such, different fields displayed on the related list.
精彩评论