Change Task should be closed only by Assigned to person?

Saranya K
Tera Contributor

Hi all,

 

The change Task should be closed only by Assigned to person and the member of the assignment group even admin should not closed the task.

 

How we can achieve this through acl or Business rule 

Thanks,

15 REPLIES 15

vishwajeet5550
Mega Guru

to ensure that a Change Task can only be closed by the Assigned to person, you can achieve this by modifying the Business Rule or Access Control Rule (ACL) for the Change Task table. Specifically, you can create a Business Rule that enforces this restriction by checking if the current user is the same as the person assigned to the task when attempting to close the task. This rule should be applied when the State field of the Change Task is changed to "Closed." The Business Rule would contain a condition that compares the Assigned to field with the current user. If the user trying to close the task is not the one assigned, the system can either prevent the update or display an error message.

You can also use UI Actions to disable the "Close" button for users who are not the assigned person. Another option is to use UI Policies or Client Scripts to hide or make the Close option unavailable for unauthorized users. By implementing this control, you ensure that only the person assigned to the task has the ability to close it, maintaining proper task management and accountability within the Change Management process.

Gaurav Shirsat
Mega Sage

Hello @Saranya K 

Please add the condition in condition section of UI Action as Follow 

current.assigned_to==current.gs.getUserID()||current.assigned_to==gs.getUser().isMemberOf(current.assignment_group)

 

Please arrange the brackets properly

 

Thanks and Regards

Gaurav Shirsat

renuka_kulkarni
Tera Contributor

 

To restrict Change Task closure to only the "Assigned to" person or members of the Assignment Group (and prevent admins from closing the task), you can use either an ACL or a Business Rule.

1. Using ACL:

  • Create a record ACL for the change_task table.
  • Set the operation to Update.
  • Add a condition to allow closure only if the Assigned to is the current user or the current user is a member of the Assignment Group.
  • Example condition:   [ current.state != 'Closed' || current.assigned_to == gs.getUserID() || current.assignment_group.members().has(gs.getUserID()); ]

renuka_kulkarni
Tera Contributor

2. Using Business Rule:

  • Create a "Before" Business Rule on the change_task table.
  • Check if the state is being set to "Closed".
  • Add a script to ensure only the Assigned to person or Assignment Group members can close the task.

Example script: 

 if (current.state == 'Closed' && current.assigned_to != gs.getUserID() && !current.assignment_group.members().has(gs.getUserID())) {
gs.addErrorMessage("You are not authorized to close this task.");
current.setAbortAction(true);
}

NikhilKumaK
Tera Expert

Hi @Saranya K 

Could you try with Before BR: Insert, Update

NikhilKumaK_0-1733224686346.png

 

(function executeRule(current, previous /*null when async*/ ) {

    // Add your code here
    if (!current.isMemberOf('assignment_group'));{
    current.setAbortAction(true);
    gs.addErrorMessage('You cannot close the change task');
    }
})(current, previous);

It works