Skip to content

Instantly share code, notes, and snippets.

@samteezy
Last active April 2, 2018 20:13
Show Gist options
  • Select an option

  • Save samteezy/399832153c88537a26a31b92bbfbd564 to your computer and use it in GitHub Desktop.

Select an option

Save samteezy/399832153c88537a26a31b92bbfbd564 to your computer and use it in GitHub Desktop.
Create a task via a flow where Community license users are not allowed to create tasks.
public class createTaskFlow{
@InvocableMethod(label='Create task' description='create tasks')
public static void insertTasks(List<Task> tasks) {
// system.debug('tasks ' + tasks);
// Note this is built for inserting just one task and is not bulkified.
for (task t:tasks){
task newTask = new task();
newTask.priority = string.valueof(t.priority);
newTask.status = string.valueof(t.status);
newTask.ownerId = t.ownerId;
newTask.whatId = t.whatId;
newTask.subject = string.valueof(t.subject);
newTask.description = string.valueof(t.description);
insert newTask;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment