Home Analyst Portal

Hide "send email" link for AD Groups in Incident

Wolfgang_SchmidtWolfgang_Schmidt Customer Adept IT Monkey ✭✭
In the Image down below you can see the "send email" link in an open Incident, which i would like to hide for a specific AD Group (or several AD Groups). Since this "Tasks" panel is not part of the Custom Forms provided by Cireson, i wonder how i could achieve this.
Do i have to use the Custom.js to remove the link, and if so, how?
Thank you in advance !

Best Answer

  • Geoff_RossGeoff_Ross Cireson Consultant Super IT Monkey ✭✭✭✭✭
    Accepted Answer
    Hi Woldgang,
    This can be done with a custom task.

    app.custom.formTasks.add('Incident', null, function (formObj, viewModel) {
       formObj.boundReady(function(){
         var userid = session.user.Id;
         //Call the API to get the User's Groups
         $.ajax({
                url: "/api/V3/User/GetUsersGroups",
                data: {id: userid},
                type: "GET",
                success: function (groups) {
                   //Loop through the groups
                   for ( i = 0 ; i < groups.length ; i++ ) {
                   //If we find the group in question, hide the task.
                        if (groups[i].UserName == <Name of AD Group>) {
                           $( ".taskmenu li:contains('Resolve Incident')" ).hide();
                        }
                   }
               }
            });
        });
        return;
    });

Answers

  • Geoff_RossGeoff_Ross Cireson Consultant Super IT Monkey ✭✭✭✭✭
    Accepted Answer
    Hi Woldgang,
    This can be done with a custom task.

    app.custom.formTasks.add('Incident', null, function (formObj, viewModel) {
       formObj.boundReady(function(){
         var userid = session.user.Id;
         //Call the API to get the User's Groups
         $.ajax({
                url: "/api/V3/User/GetUsersGroups",
                data: {id: userid},
                type: "GET",
                success: function (groups) {
                   //Loop through the groups
                   for ( i = 0 ; i < groups.length ; i++ ) {
                   //If we find the group in question, hide the task.
                        if (groups[i].UserName == <Name of AD Group>) {
                           $( ".taskmenu li:contains('Resolve Incident')" ).hide();
                        }
                   }
               }
            });
        });
        return;
    });
  • carrie_medinecarrie_medine Member Advanced IT Monkey ✭✭✭
    You may be able to accomplish this or something close by reviewing this KB:  https://support.cireson.com/KnowledgeBase/View/1166/?selectedtab=enduser#/

    You can inspect the Session.User object in the DOM within your custom.js and trigger the hide based on information within that element.   It does not contain a list of AD Groups that the user is a member of however you could feasibly use the API call documented here to retrieve a list of the users groups:  https://support.cireson.com/Help/Api/GET-api-V3-User-GetUsersGroups_id


  • Wolfgang_SchmidtWolfgang_Schmidt Customer Adept IT Monkey ✭✭

    Hi,

    thank you for the suggestions. I will look at it and sign up to you.

  • Fredrik_BorchseniusFredrik_Borchsenius Customer IT Monkey ✭
    Did you get this to work? I'm struggling with a similar problem.
  • Wolfgang_SchmidtWolfgang_Schmidt Customer Adept IT Monkey ✭✭

    Yes, we found a solution.

    In custom.js you have to add the following lines:


    app.custom.formTasks.add('Incident', null, function (formObj, viewModel) {
     formObj.boundReady(function() {
      $("#actionLogisPrivate").trigger("click");
      HideSendMailForGroups();     

      
    function HideSendMailForGroups(){
     var userid = session.user.Id;
     
     //Define the groups which can't see the "send email" link here:
     var stsgroups = ["3rdL_AD_Group","2ndL_AD_Group","1stL_AD_Group"];
     
     $.ajax({
      url: "/api/V3/User/GetUsersGroups",
      data: {id: userid},
      type: "GET",
      success: function (groups) {
       for ( i = 0 ; i < groups.length ; i++ ) {
        if (contains(stsgroups,groups[i].UserName)) {
         $( ".taskmenu li:contains('Send Email')" ).hide();
        }
       }
      }
     });
    }


  • Fredrik_BorchseniusFredrik_Borchsenius Customer IT Monkey ✭
    Thank you
Sign In or Register to comment.