The CreatorCon Call for Content is officially open! Get started here.

Lock down the ACL of a task to only the assigned to user

SC10
Kilo Guru

I have a need to lock down the entire ACL of a task record, to only the user who in which the task is assigned to. This task and others like it, will be automatically assigned to specific users by a workflow, and if the assigned to field is ever blank an admin can simply take over and assign it to someone (or similar operation).

I've tested making a new ACL record for sc_task (not sc_task.* for the relevant records), but in the condition builder the closest item I could find is "Assigned to = is (dynamic)", what I'd need is an "Assigned to = is NOT (dynamic)".

Anyone have any idea how this can be setup, and scripted if necessary?

Thank you.

1 ACCEPTED SOLUTION

Shane,



Small correction in the script is



getAccess();



function getAccess()


{


if(current.private == "Yes")


{


if(current.assigned_to == gs.getUserID())


{


return true;


}


else


{


return false;


}


}


return true;


}


View solution in original post

8 REPLIES 8

adiddigi
Tera Guru

You can write this script   in a write access control on sc_task.*



current.assigned_to == gs.getUserID();


manikorada
ServiceNow Employee
ServiceNow Employee

Shane,



Have the ACL script has something like:



getAccess()



function getAccess()


{


return (current.assigned_to == gs.getUserID());


}


How would I add another condition on to the script, to check and see if a current value on the task record matches something?



My end goal is to only show a certain kind of task (controlled by the value of "Private"), to the user it's assigned to. In any other situation it would not be visible in the system to anyone but admins.


Would it be:



getAccess();


privatetask();


function getAccess()


{


return (current.assigned_to == gs.getUserID());


}


function privatetask()


{


return (current.private == "Yes");


manikorada
ServiceNow Employee
ServiceNow Employee

Shane,



In that case it owuld be like this:


getAccess();



function getAccess()


{


if(current.private == "Yes")


{


return false;


}


return (current.assigned_to == gs.getUserID());


}