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
Mack DsozaMack Dsoza 

Error Correction

System.DmlException: Upsert failed. First exception on row 1; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [Quantity]: [Quantity] 
Class.InvestmentAssetServices.save: line 98, column 9 Class.InvestmentAssetController.save: line 113, column 13 External entry point

 

Please tell me how to avoid this error,

Since I have 3 command link, On click of each command link different-2 layout opens but on Click of MF & FI command Link Quanitiy is required field but on click of Stock, it is not required but when i put required for those two(MF, Fi) so while inserting again it shows me that required for Stocks too..

 

Please tell me that what to do for this problem...

Best Answer chosen by Admin (Salesforce Developers) 
Shashikant SharmaShashikant Sharma

This error suggest me Quantity field is required from Object Level (Means Quantity is Database Required Field) and because you are not providing a value in it and inserting thats why this error is coming. You can not leave null value in a field which is required from Database level. If you don't want this to be filled every time then either make it non required or set a default value for the field.