I'm trying to create a Task
via Apex, and I'm trying to set the Type to "Call":
Task task = new Task();
task.Type = 'Call';
task.Subject = 'Paid signup';
task.WhatId = account.Id;
task.Status = 'New';
task.ActivityDate = Date.Today().AddDays(7);
task.OwnerId = account.OwnerId;
task.Description = 'Contact: ' + contact.Name + '\r\n' + 'Contract: ' + contract.ContractNumber;
insert task;
And I'm getting the following error on the second line where I assign "Call":
Line: 2, Column: 6
Variable does not exist: Type
I'm basing my code off this example: https://www.brcline.com/blog/creating-tasks-salesforce-apex
Type definitely exists:
How do I fix this code so that it works?
Task task = new Task(Type = 'Call', Subject = 'Paid signup', ...);