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
Developer BaseDeveloper Base 

Prepopulate quantity with value 1

Hey guys, I have a custom object for Product line items. I need to prepopulate the Quantity with value 1 when creating a record.

So far I know it works as a standard function with Opportunity:

https://help.salesforce.com/articleView?id=customize_oppproduct.htm&type=5

But with custom objects I can not find a solution. How?
Devi ChandrikaDevi Chandrika (Salesforce Developers) 
Hi,

Try by giving field  default value as 1 in the field.Default field values automatically prepopulate the value of a custom field when a new record is created.
Edit the field definition of your custom field and set default value as 1

https://help.salesforce.com/articleView?id=fields_defining_default_values.htm&type=5 (https://help.salesforce.com/articleView?id=fields_defining_default_values.htm&type=5)

Hope this helps you
Let me know if this helps you. Kindly mark it as solved so that it may help others in future.

Thanks and Regards