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
mukesh gupta 8mukesh gupta 8 

Custom textfield

Hi Expert,

How can insert value in custom textfiled. when i used insert method then facing error. I am sharing error screen shot.

User-added imageUser-added image 

Please suggest.

Thanks
Mukesh
Manmohan SinghManmohan Singh
Hi Mukesh,

You have not provided the required field, looks like you missed that
Add a.Name = 'test'; and this should work :)

Regards, Manmohan
 
badibadi
Account has a required field of name and thats null so you are getting the error. try this 
 
Account a = new Account();
a.Name='New Account';
a.Test_LightingCo__Account_Name__c='pp';
insert a;

 
Prashant Pandey07Prashant Pandey07
Account acc=new Account();
acc.Name='Testing dev console';
acc.Test_LightingCo__Account_Name__c='pp';
if(acc!=null)
insert acc;

Please make mark this as a best answer if your satisfied..