In Account for Recordtype Company i have to give two different names for a test class on account trigger? How to do that ?
Account accobj = new Account();
accObj.RecordType.Name = 'SomeName';
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It only takes a minute to sign up.
Sign up to join this communityIn Account for Recordtype Company i have to give two different names for a test class on account trigger? How to do that ?
Account accobj = new Account();
accObj.RecordType.Name = 'SomeName';
you have to query the RecordType using the developer/api name and assign the id of the record type to the records RecordTypeId field..
RecordType rt = [Select Id from RecordType where DeveloperName = 'YourRecordTypeName'];
Account accobj = new Account();
accObj.RecordTypeId = rt.Id;
there should be some previous answers which can give you more details..
here's one i found : Creating a new record with giving record type