0

I have a page within my community where a Customer Community user can update some information about themselves (information is saved on Account). I want to create a Task alerting the user that owns the account that information has been changed. Initially i had no issues. I (system admin) profile was the owner of the account I used for testing and tasks were created without problem. However with some further testing in which some other users in the system were the Account owners i received this error.

Error

Initial thought was that the Account owner user was missing some permissions but i am at a loss to which permissions. They own the Account record (Account is also Public Read/Write). The Account owner profile has Access Activities and Edit Tasks permission.

The Customer Community profile has the Access Activities permission but Edit tasks is not in System Permissions. So possibly they can not create tasks but why can they create tasks for a system admin user without issue? They also have no problem updating fields on the account.

Here is my Apex Code, the outer class is with sharing

@AuraEnabled
public static Task sendTask(Id acctId, Id acctOwnerId, String changeReference) {

    Task tsk = new Task();
                 tsk.Subject = 'Profile Has Been Updated';
                 tsk.Status = 'Open';
                 tsk.Priority = 'Normal';
                 tsk.WhatId = acctId;
                 tsk.OwnerId = acctOwnerId;
                 tsk.Description = changeReference;
    try {
        insert tsk;
        return tsk;
    }
    catch (Exception e) {
    // "Convert" the exception into an AuraHandledException
        throw new AuraHandledException(e.getMessage());    
    }

}
0

Even though Apex runs in system context, with sharing still imposes certain user-level restrictions, and one of them is that community users cannot assign tasks to internal users, only to themselves. You'll need to use without sharing to make this work.

| improve this answer | |
  • Is there any documentation that says community users can't assign tasks to internal users? – Bobbygllh Apr 9 at 20:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.