Home Self-Service Portal - Community

Hide Incident and Service Request tasks for end user on portal

Kathy_HustKathy_Hust Customer IT Monkey ✭
Need to hide the following tasks for Incident and Service Request for end users. 

Incident Tasks:
Update Status
Resolve

Service Request Tasks:
Cancel Request
Update Status
Complete Request

I have worked with the custom.js file but have been unable to find the right code to hide these tasks for end users.

Any assistance is greatly appreciated.

Thank you 

Best Answers

Answers

  • Kathy_HustKathy_Hust Customer IT Monkey ✭
    Roland_Kind Thank you that fixed my issue.
  • Jeff_LandersJeff_Landers Customer IT Monkey ✭

    @Roland_Kind,   Can you clarify what file this change applies to?  Does it work for both SR's and IR's?

    Thank you

    Jeff

  • Jeff_LandersJeff_Landers Customer IT Monkey ✭
    No. I am not familiar with scriptloader function   I have it working directly in the custom.js that our consultant did for us but it sounds like that is not best practice.  Can you elaborate please?
  • Jeff_LandersJeff_Landers Customer IT Monkey ✭
    @Geoff_Ross

    Is there a way to determine if a user is a member of a certain support group??
     //If the user is not in GROUPX, hide the task
      if (!session.user.GROUP) {   hide the task
  • Geoff_RossGeoff_Ross Cireson Consultant O.G.
    Jeff,

    Not easily, but haven't you realised yet... There's always a way.
    $.ajax({
        url: "/api/V3/User/GetUsersGroups",
        data: {Id: session.user.Id},
        type: "GET",
        success: function (data) {
            console.log(data);
            var member = false;
            for ( i=0 ; i < data.length ; i++ ) {
                if (data[i].Name.indexOf("SCSM Portal - Create Problems") != -1 ) { 
                    console.log("true");
                    member = true;
                }
            }
            if (member != true) {
                $( ".taskmenu li:contains('Convert to PR')" ).hide()
            }
        }
    });

    We have to get all the groups a user is in via the API call and then loop through them looking for a group in question. If we don't find it we hide the task.

    This is quite expensive so use sparingly. Also I've written it out step by step here, it could no doubt be improved and optimised.

    Geoff
Sign In or Register to comment.