You need to sign in to do that
Don't have an account?
Siddharth Lakhotia
Field is not writeable: Task.Owner
Hi,
I am getting following error while writting Test class
I am getting following error while writting Test class
function readOnly(count){ }
You need to sign in to do that
Don't have an account?
Firstly you just insert user with a profile and use runasuser.
Profile p = [SELECT Id FROM Profile WHERE Name='ProfileName'];
User u = new User(Alias = 'standt', Email='standarduser@testorg.com',
EmailEncodingKey='UTF-8', LastName='Testing', LanguageLocaleKey='en_US',
LocaleSidKey='en_US', ProfileId = p.Id,
TimeZoneSidKey='America/Los_Angeles', UserName='standar123456duser@testorg.com');
System.runAs(u)
{
Task t = new Task();
t.OwnerId = u.id;
t.Subject='Donni';
t.Status='Not Started';
t.Priority='Normal';
insert t;
}
try this in your method.