write ACL's based on planned start date and end date

shaik riyaz1
Tera Contributor

I have a below requirement and how to achieve this through ACL?

WHEN I open the Scrum Task and enter the Planned hours in the field

 

THEN I see the below validation:

 

         if the current date-time is between Story.Sprint.Planned start date and Story.Sprint.Planned end date on scrum task, AND Story.Assignment Group is “ITSM group” or “CMDB group” or “Platform group” or “Major incident group”

        then the “Planned hours” field should be editable only to members of the group “Scrum Admins”

1 ACCEPTED SOLUTION

Sandeep Rajput
Tera Patron
Tera Patron

@shaik riyaz1 Here is a rough idea on the script that you could use on the write ACL for your scrum task.

 

answer = false;
    // Get the assignment group of the story
    var assignmentGroup = current.story.assignment_group.name;    
    // Check if the assignment group is one of the allowed groups
    var allowedGroups = ['ITSM group', 'CMDB group', 'Platform group', 'Major incident group'];
    if (allowedGroups.indexOf(assignmentGroup) !== -1) {
        
        // Check if the current time is within the sprint start and end dates
            var now = new GlideDateTime();
            var sprintStart = current.sprint.getValue('start_date');
            var sprintEnd = current.sprint.getValue('end_date');
            
            if (now >= new GlideDateTime(sprintStart) && now <= new GlideDateTime(sprintEnd)) {
                // Check if the user is a member of the 'Scrum Admins' group
                answer= gs.getUser().isMemberOf('Scrum Admins');
            }
}

Hope this helps.

View solution in original post

1 REPLY 1

Sandeep Rajput
Tera Patron
Tera Patron

@shaik riyaz1 Here is a rough idea on the script that you could use on the write ACL for your scrum task.

 

answer = false;
    // Get the assignment group of the story
    var assignmentGroup = current.story.assignment_group.name;    
    // Check if the assignment group is one of the allowed groups
    var allowedGroups = ['ITSM group', 'CMDB group', 'Platform group', 'Major incident group'];
    if (allowedGroups.indexOf(assignmentGroup) !== -1) {
        
        // Check if the current time is within the sprint start and end dates
            var now = new GlideDateTime();
            var sprintStart = current.sprint.getValue('start_date');
            var sprintEnd = current.sprint.getValue('end_date');
            
            if (now >= new GlideDateTime(sprintStart) && now <= new GlideDateTime(sprintEnd)) {
                // Check if the user is a member of the 'Scrum Admins' group
                answer= gs.getUser().isMemberOf('Scrum Admins');
            }
}

Hope this helps.