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

Remove the Create New button from Incident Task if Incident is assigned to a specific group

Cupcake
Mega Guru

If someone can provide any assistance I would be most appreciative.

I have a customer who wants the "Create New" button removed from the Incident task if the Incident is assigned to a specific group.

If the Incident is not assigned to that group then the Create New button should be there.

Not sure if this needs to be accomplished via a Business Rule or Client Script.

So I see that I would need to update this in two places.

a) Directly remove the Create Inc task button from the Incident if the Incident is assigned to a specific group:

        find_real_file.png

b) Remove the New button directly on the Incident Task.

find_real_file.png

Thanks,

Karen

19 REPLIES 19

Ohh Ohkk. I am sorry misunderstood the requirement a bit.


Yeah you can update your script as you mentioned above "answer=(parent.assignment_group !='b85d44954a3623120004689b2d5dd60a');" which will work for your scenario.



Hope this helps.Mark the answer as correct/helpful based on impact.



Regards,


Shloke


Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

Thank you for responding. I just changed the script and I impersonated a member of that assignment group and yes they can still see the New button, but I also impersonated someone that is not in that assignment group and they still see the new button. They shouldn't be able to. See below:



find_real_file.png



Not sure why this is not working.


HI Karen,



Thank you for your responses.



But I think there are two different requirements running in this post here,


in your initial post you mentioned you would want to hide New button for incident tasks where the parent (i.e. ticket) is assigned to a particular group,


whereas after I see the requirement became more whether the actual user logged in is part of a group or not.



In any way, I suggest the use of ACL as well as they are access controls of the platform and can prevent operation like creation of records whichever way one could create, not only by disabling one button while there may be several other ways users can create such record.



Best regards,


Andras


HI Andras - I responded your resolution (see below):



      I created the "Create" ACL the way that you suggested and it wasn't working


find_real_file.png


So then I created it a little differently to say that you can only create an Incident task if the current assignment group = <that assignment group> and if you are a member <of that same assignment group>. I impersonated someone that is not a member of that assignment group to create a new incident task.



After thinking some more on the way I did the script, I would need to say in the script that you can create an incident task if the parent assignment group is = < that assignment group> and you are a member of that <assignment group>. So then I wrote the script as such.


if(parent.assignment_group=="98947af86f8d250055b74702be3ee413"){ //CSC


      if(gs.getUser().isMemberOf("98947af86f8d250055b74702be3ee413")){


              answer=true;


      } else{


              answer=false;


      }


      } else answer=true;




I also tried this way



if(current.parent.assignment_group=="98947af86f8d250055b74702be3ee413"){ //CSC


      if(gs.getUser().isMemberOf("98947af86f8d250055b74702be3ee413")){


              answer=true;


      } else{


              answer=false;


      }


      } else answer=true;



I also create a write ACL with the same script in it as Harman Gill suggested.



None of the ways are working.


Do I need to change the script a little differently.



find_real_file.png



Thanks,


Karen


HI Andras,


      I finally got it working correctly. I had to update the script as follows:



if(current.u_inc.assignment_group=="Sys id of Assigment group"){


      if(gs.getUser().isMemberOf("Sys id of Assignment group")){


              answer=true;


      } else{


              answer=false;


      }


      } else answer=true;



But now I discovered another issue. If I am the caller of that Incident and I have an "itil" license and I go in on the back-end and find the INC that was opened for me, the fields are editable. If I am not the caller then the script works perfectly.



Trying to solve for that now. I will let you know.



Thanks,


Karen