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
Josh StigallJosh Stigall 

Add multiple records to custom object

Hi all.

A core part of our business process is collecting the crops to be planted in a farmer's fields as part of a 'crop plan.' We have created a custom object to collect the data that we need to have for the crop plan. This crop plan will always have more than one crop planted by a farmer in more than one field. (A physical field, not a field in Salesforce.)

Is there a way to allow users to enter more than one crop to a famer's crop plan? Specifically, is there a way to add a button, for example, called 'additional crops' that will add a record to the user interface allowing multiple crops to be entered.

What we envision is a button that will duplicate two fields, 'crop' and 'acres planted.' In the end, a user will be able to enter a crop and the number of acres to be planted, click a button that will add another 'crop' and 'acres planted' fields. (In this case, the fields will be fields in salesforce.)

I know that we can add several 'crop' and 'acres planted' fields to the object, but we'd like this to be created by a user using the button, because different farms will have a different number of crops planted. That is, we don't want to create, say 5 'crop' and 'acres planted' fields to the object because some farmers will have 4 crops, some farmers will have 7 crops. We want the interface for entry to look cleaner than having a number of different fields for users to input data.

I hope this is a clear enough explanation for what we're looking for. I can provide more info and screenshot if that is helpful. (This is my first post, so I know I may be unclear in what I'm asking for.)

Thanks, in advance, for your advice.
Mubeen QawiMubeen Qawi
How do envision the data model? Looks like Crop Plan is the parent where as Crop and acres planted is child?
Josh StigallJosh Stigall
Right now we have a lookup relationship between the Crop Plan and the Crop object, but the Acres Planted will not be a discrete object. It will just be a field in the Crop Plan.