Hide a UI Action Button for tickets assigned to a specific group

Cupcake
Mega Guru

I want to remove the UI Action Button "Create Inc Task" from anyone IF (see the conditions below)

        a. The ticket is assigned to a specific assignment group

        b. And you are not a member of that group

find_real_file.png

What is the best way to accomplish this?

I know that you can do a hide/show via a UI Policy but I am not sure what to put in the script.

What is the risk (if any) of doing the UI Policy?

Is there a better way to accomplish this? If so, you could please provide a solution?

Thanks,

Karen

1 ACCEPTED SOLUTION

Yes, since this condition is a bit complex, the only way I can think of is creating a script include and calling the script include in UI Action condition. I am giving you a tried and tested script, let me know if it works:



UI Condition: new showCreateTask().canView(current,gs)




Script Include: Name: showCreateTask




var showCreateTask = Class.create();


showCreateTask.prototype = {


      initialize: function() {


      },


  canView : function(current,gs)


  {


  if(current.assignment_group == 'sys_id of your group' && gs.getUser().isMemberOf(current.assignment_group))


  return true;


  if(current.assignment_group != 'sys_id of your group')


  return true;


  else


  return false;


  },


      type: 'showCreateTask'


};


View solution in original post

10 REPLIES 10

anjalichoudhary
Kilo Guru

Hi Karen,



As per your requirement you can give the condition in the UI Action like this: gs.getUser().isMemberOf(current.assignment_group)



Regards,


Anjali