You need to sign in to do that
Don't have an account?
Jithesh Vasudevan
How to set the owner type for Case in a test class ? I have set the Owner to the case against the dummy user I have created. But can't set the owner type for it and it gives me a null value because of that.
Profile p= [Select Id from profile where Name='System Administrator'];
User u=new User(firstname = 'ABC',
lastName = 'XYZ',
email = 's-abe=kureha.co.jp@example.com',
Username = 's-ab@kureha.co.jp.sd',
EmailEncodingKey = 'ISO-8859-1',
Alias = 'ShAbe',
IsActive=true,
TimeZoneSidKey = 'America/Los_Angeles',
LocaleSidKey = 'en_US',
LanguageLocaleKey = 'en_US',
ProfileId = p.Id);
insert u;
Case c = new Case(Status='New',OwnerId=u.Id);
insert c;
User u=new User(firstname = 'ABC',
lastName = 'XYZ',
email = 's-abe=kureha.co.jp@example.com',
Username = 's-ab@kureha.co.jp.sd',
EmailEncodingKey = 'ISO-8859-1',
Alias = 'ShAbe',
IsActive=true,
TimeZoneSidKey = 'America/Los_Angeles',
LocaleSidKey = 'en_US',
LanguageLocaleKey = 'en_US',
ProfileId = p.Id);
insert u;
Case c = new Case(Status='New',OwnerId=u.Id);
insert c;
Raj Vakati
Use this code