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
Sarika PatelSarika Patel 

​Is there a way to make a related list mandatory in Standard Object of Salesforce?

Hi,

I have a requirement in which I have to select a field from Pickllist, once selected I have to add an amount in textbox and save. To serve this purpose, I created a related list.

Now the problem, is I want that related list to be filled, meaning I want to keep it mandatory as soon as the opportunity is created. I cannot place the related list at the time of creation, since it is a standard page. 
Hence, I am fine with an pop-up or message saying that you need to fill the values in the related list, once my opportunity is created.

Thanks,
Sarika 
logontokartiklogontokartik
Hi Sarika, I am not sure if I understand your requirement. You have a requirement to add amount if a specific picklist value is selected? Is that right, I am not sure how related lists came into picture. Can you please elaborate?
Sarika PatelSarika Patel

Its actually, there is a list of categories, and based on each category, I have to add an associated amount. Is there any other way except the custom object for that?
Kenneth AndersenKenneth Andersen
I don't fully understand your requirement either, but it sounds like you could do this using a validation rule.
Sarika PatelSarika Patel
I have a related list at the bottom of my opportunity object called "Project Countries".  This list has multiple fiels that give information around security, travel, and tax pertaining to each country.  I want to require that the user create at least one record (every project has a corresponding country) before they can save the opportunity.  Any thoughts are greatly appreciated!

Here are some screen shots showing what I've described above:

1.  Screen shot of the "Project  Countries" related list on the Opportunity Object:
[Project Country List on the Opportunity Object]
User-added image
2.  These are the fields that are filled out when a new record is created on "Project Countries".  The goal is to have the user fill out information about at least one project country before the opportunity is saved.
User-added image
[These are the fields that are filled out when you create a new record in "Project Countries"]
logontokartiklogontokartik
Just to make myself clear, does this need to be done on every new opportunity (if yes, you need to write custom visualforce page). or only if something on the opportunity changes (update a field etc?). You can then basically write a trigger and throw an error if no project country records are available.