How to provide limited ability to Delete Project Task

guislainlagron
Giga Contributor

Hi,

I have 1 clarification & 1 need.

Clarification:

  • It appears that according to the Task Delete Record ACL and Delete [Global] UI Action, that users who have project_manager role should be able to delete a Project Task from the form, but as I impersonate such a user I do not see the Delete button. Why?

Need:

  • I would like to enable a project_user to delete Project Task, as long as they created it and its state is Pending, so I created the following UI Action
    • Name=DELETE
    • Table=Project Task
    • Action=sysver_delete
    • Active=true
    • ShowUpdate=true
    • Client=true
    • FormButton=true
    • OnClick=confirmAndDeleteFromForm()
    • Condition=current.isValidRecord() && current.canDelete() && gs.getUserID() == current.sys_created_by && current.state == 1
    • Script=current.deleteRecord();
    • RequiresRole=project_user
  • Yet, when I impersonate such a user my DELETE button does not show up on the form for a Pending Project Task which I just created. Why?

My questions are:

  1. Is the solution to my need correct?
  2. If so, is it related to the clarification, not working as expected?

Any hint would be appreciated; thanks!

Guislain

17 REPLIES 17

Looks strange.


Everything is looking good.


Can enable Debug Security Rules and open a project task record.



Then below the rendered form search for text pm_project_task/delete


It should all be Green like shown here in attached picture.



Screen Shot 2017-03-14 at 11.34.17 PM.png



If it is red, then probably you have some customization in ACLs which preventing the Delete action from appearing.



If it is all green and still Delete button is not coming, then check the UI Action Delete on Global if there is some customization which is preventing it from appearing.


Hi Arun,



OK digging into debugger...


  1. Turned on Debug Security.
  2. Impersonate Amelia Caputo
  3. Took shortcut to PRJTASK0010068 "My Pre-Project Team Kickoff Meeting" assigned to Amelia Caputo
    • find_real_file.png
  4. Search "record/pm_project_task/delete" and get 1 of 9 found

        find_real_file.png


    • First refers to OOTB ACL with it_manager_role which Amelia does not have; so far so good , albeit I am suspicious of the condition phrasing

                            find_real_file.png


    • Second refers to custom ACL with it_project_user role which Amelia does have; so far so good , albeit I am suspicious of the condition phrasing

                            find_real_file.png


        find_real_file.png


    • But will ignore that for now, since it seems to execute the same rules from cache

        find_real_file.png


    • Will ignore 1st since ACL refers to OOTB it_manager_role
    • But wonder why 2nd is now , and I am not sure how to interpret the last rule returning RC = false for CONTEXT = pm_project_task.sys_id=null


Having said so, following the UI Action breadcrumb trail, and inactivating my custom UI Action, which I described on my original post,


        find_real_file.png


did solve the problem for both Amelia Caputo with the it_project_user role


        find_real_file.png


        until she starts to work on her task,


        find_real_file.png


and Guislain Lagron with the it_manager_role role.


        find_real_file.png


Thank you both Earl & Arun; I feel a bit , but I did a lot of learning on this one!



You help was much appreciated!



Guislain


Although there is a lot of point/click configuration/development in ServiceNow, it's not always easy to sort out the right things to click on and how to set things to make sure they work the way we want them to. It is definitely a learning experience. Glad you got it sorted out.



Earl