Skip to main content

KI-129

Completing a task on behalf of the assignee changes the owner of the task and sends an additional email

Created date

10/02/2024

Updated date

10/02/2024

Status

Done

Related work item

PLTFM-2975

Description

When a document collaborator completes a workflow task on behalf of the task assignee, the task assignee should remain as the owner of the task. However, the document collaborator actually replaces the task assignee as the owner of the task, causing the original intended assignee to lose access to the task. Additionally, the document collaborator will receive an email notifying them that they were assigned the task that they had just completed.

Affects version(s)

Komodo Publications Planning Spring '24

Impacted capabilities

N/A

Steps to reproduce

  1. Ensure that the Complete Tasks on Behalf of Other Users (mvn__CM_Task_Completion_On_Behalf_Of_Enabled__c) field on the Default (PP_Default) MCM Global Setting (mvn__CM_Global_Setting__mdt) custom metadata record is set to true. You may need to clear the Platform Cache if you update the Default metadata record.

  2. Ensure that you have the CM_CompleteTasksOnBehalfOfOthers (CM_TaskApproverOnBehalfOf) permission set, which contains the CM Complete Tasks On Behalf Of Others (CM_Task_Completion_On_Behalf_Of) custom permission.

  3. Create a new document.

  4. Start a workflow on the document, assigning at least one of the workflow tasks to another user.

  5. Mark the workflow task that was assigned to another user as complete.

Notice that the Owner field on the Task record shows your name instead of the other user’s name. You will also receive an email notification for being assigned the Task record that you just marked as complete.

Workaround

A workaround for this known issue is to create a trigger on the Task object that prevents the owner ID from updating and instead populates a new Completed By (Completed_By__c) field with the document collaborator who completed the task on behalf of the actual assignee and owner of the task:

  1. Create the following trigger on the Task object.

    trigger Task on Task (before update) {
        if(Trigger.isBefore && Trigger.isUpdate) {
            for(Task newTask : trigger.new) {
                Task oldTask = trigger.oldMap.get(newTask.Id);  // prevent the ownerId from being overridden
                if(newTask.OwnerId != oldTask.OwnerId && newTask.Status == 'Completed' && oldTask.Status != 'Completed ' && newTask.mvn__CM_Complete_On_Behalf_Of_Flag__c) {
                    newTask.Completed_By__c = newTask.OwnerId;
     newTask.OwnerId = oldTask.OwnerId;
                }
            }
        }
    }
  2. Create a new Completed By (Completed_By__c) field on the Activity object. The field should look up to the User object.

  3. Modify the formula for the Owner Name (mvn__CM_Owner_Name__c) field on the Activity object. If the Completed By field is populated, then all references to the Owner field should be replaced with the Completed By field. If the Completed By field is blank, then the formula remains the same.

Fix version

Komodo Publications Planning Fall '24

Resolution notes

Upon upgrading to Komodo Publications Planning Fall '24, which will be released in November 2024, revert the changes that you made based on the workaround. Komodo Publications Planning Fall '24 will include a fix for this known issue and several enhancements for this feature.