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
nishad basha 7nishad basha 7 

How to create a user using visualforce page and create a form with 6 user fields and fill remaining fields in controller when i click submit button new user should be created?

user is created in salesforce after that creating visualforce page  with a form and add 6 user fields remaining fields in controller when i click submit button new user should be created.how to solve the above solution please give some examples.
Ravikant kediaRavikant kedia
Below code is used to create user in apex.
User mike = new User();
mike.ProfileId = '00Ee0000000LhpB';(your profile id);
mike.Username= 'mike.white@company.com';
mike.Email = 'mike.white@company.com';
mike.Lastname = 'mike'; mike.Firstname = 'white';
mike.Alias = 'mwhite';
mike.CommunityNickname = 'mwhite01';
mike.UserRole = [ select id from userrole where id ='00Ee0000000LhpB' ];
mike.Profile = [ select id from profile where id = '00ee0000000Hfng' ];
mike.CurrencyIsoCode = 'USD';
mike.TimeZoneSidKey = 'GMT';
mike.LocaleSidKey = 'en_US';
mike.EmailEncodingKey = 'ISO-8859-1'; mike.LanguageLocaleKey = 'en_US';
mike.UserPermissionsMobileUser = false; System.debug ( JSON.serializePretty( mike ) ); insert mike;
nishad basha 7nishad basha 7
my requirement is creaing visualforce page and add that 6 user fields  remaining fields in controller when i click submit button new user should be created.
Ravikant kediaRavikant kedia
We here to guide how to create visualforce page not for creating visualforce page for you.