function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SSimionSSimion 

OLI in Salesforce Lightning

Hi,

I am in Lightning and I am currently using Salesforce's standard functionality of adding products on an opportunity.

As we have different types of products, when the users are selecting the products from the Add Products page and click the button Next, I want to be able to hide a Lookup field to a custom object I have created on the OLI - depending on the type of product selected. 

Also, when the Lookup field is showing on the OLI for some of the products, I want to prepoluate another two fields from the OLI with the values of the records from the Lookup field.

Is it possible to achieve this only by creating an Apex code? Without having to create a Visualforce page?


Thanks a lot.
SEKAR RAJ.SEKAR RAJ.
Hi Simion,
For Prepopulating values:
1. You can use a formula field to fetch and display the lookup fields
2. You can create the apex trigger, then you can populate values based on the custom approach.
Hiding and Displaying fields:
Hiding and displaying the fields in Salesforce based on the page layout and Record Types.

So here, there is no need for creating a visualforce page to prepopulate values.

Thanks.
SEKAR RAJ