Home General Discussion

Hide Tasks Incident Form if tab equals

CaterhamITSupportCaterhamITSupport Member Advanced IT Monkey ✭✭✭

Dear All,

Does anyone have some code which will hide a task item on the incident form if tab equals a name?

Kind Regards

Daniel

Answers

  • Konstantin_Slavin-BoKonstantin_Slavin-Bo Customer Ninja IT Monkey ✭✭✭✭
    var taskToHide = "Updated By Higher Tier";
    var tabWhereToHideTask = "RelatedItems"; // w/o spaces
    
    $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
      if($(e.target).data().cid == tabWhereToHideTask) {
            $(`[data-bind="click: customFunc"]:contains("${taskToHide}")`).hide();
            $(`[data-bind="click: ${taskToHide}"]`).hide();
        } else {
            $(`[data-bind="click: customFunc"]:contains("${taskToHide}")`).show();
            $(`[data-bind="click: ${taskToHide}"]`).show();
        }
    });
    

    Quickly put together, but seems to work fine.

    You haven't specified whether you need to hide built-in tasks or custom ones, so I've included a line to hide either type. Specify the task to hide, and the tab in which to hide it, in the first two lines.

  • CaterhamITSupportCaterhamITSupport Member Advanced IT Monkey ✭✭✭

    How would you hide tasks based on support group too?

    Thank you for the help with this.

  • Konstantin_Slavin-BoKonstantin_Slavin-Bo Customer Ninja IT Monkey ✭✭✭✭

    Attach an event handler to the TierQueue picker (same as Simon helped you with Classification, just for TierQueue instead) and the code to hide the task is above.

Sign In or Register to comment.