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

nayanawadhiya1
Kilo Sage

Hey Lagron,



Check the ACL on that Table.


There would be a DELETE ACL which having some roles through that it is restricting the project_manager if it is not present in that ACL's Role.


arun_vydianatha
ServiceNow Employee
ServiceNow Employee

Which release you are on?



From Geneva on we need it_project_manager to delete a project task.


So for (1) did you have the it_project_manager when you impersonated or just project_manager?



For (2)



Creating a Global UI Action for Delete for project users is not the recommended solution for the problem you are having.



I would suggest the following


1. Create a new Delete ACL for pm_project_task table


2. Give it role it_project_user


3. On condition give state == 1



Note On condition builder, if you choose Created By - platform doesn't give option is dynamic (ME).


Perhaps you can consider using assigned_to field instead of created by field


Hi Arun,



Thanks for the prompt reply, Arun.



Yes good question, I had noticed the change between Helsinki & Istanbul regarding project_manager & it_project_manager changes.



I am on the Istanbul Developer Sandbox, and yet even logged as System Administrator, I do not see the UI Action delete button on a project task, albeit the Delete action is enabled.


Delete Project Task.PNG


Even though:


  • Project Task table ACL shows
    pm_project_taskdeleterecordtrue
    where it requires it_project_manager role, and has Admin overrides enabled.


I like the ACL suggestion, but I cannot add an ACL to the table.


STRY0118030a - Data Management - Manage Table - Project Task - ACL.PNG


What am I missing?



Thanks,



Guislain


guislainlagron,



Did you elevate your role/privileges to security_admin before you tried to add the ACL?



Earl