I'm trying to create a Task in Apex, but it doesn't seem to be working. Here's my actual code:
RecordType rt = [SELECT Id FROM RecordType WHERE Name = 'Some Record Type' AND SobjectType = 'Task'];
Task logCall = new Task(WhatId = friend.Id, RecordTypeId = rt.Id, Type = 'General Task', Subject = 'Here\'s my subject', Description = 'Description');
System.debug('@@@@@@@@@@@');
try {
insert logCall;
} catch (DmlException e) {
ApexPages.addMessages(e);
return appendId(Page.SomeView);
}
When I execute that, there are no error returned to my view. When I check at the developer console, I get this error message:
15:35:28:208 VARIABLE_ASSIGNMENT [3]|this.message|"You do not have priv (40 more) ..."|0x67e122
15:35:28:208 VARIABLE_ASSIGNMENT [4]|this.message2|"You can not modify t (61 more) ..."|0x67e122
Any idea how to prevent that from happening?
Thanks.
You do not have priv...
andYou can not modify t
?