UI macro visibility

mrcarter
Tera Contributor

I have an update button in our incident form which when in the portal under resolved calls I want to hide.   I tried creating UPdate UI action and created against Incident but I want that button to be only visible if the call is not resolved or closed.   I am struggling to get the conditions to work.  

CAn anyone help?

10 REPLIES 10

You were right Chuck that roles one was rubbish, updated now but still showing on the incident form for a resolved call



find_real_file.png


Can you describe the conditions where you want the button to appear? I'm getting them in pieces. So far what I have is this:



  • If incident is "closed" (active==false), don't show the update button.
  • If the incident is resolved, only show the button to roled users. Non-roled users don't see it.
  • If the incident is any other state, show the button.


Is that correct?


HI Chuck, yes it was a little bit scattergun approach, I blame the man flu I have.



So...



I want the button to be visible in the back end for role holders.   Whether the call is open or resolved.   There are still situations whereby a team may put some add comments in despite the call being resolved which is fine.



I want the button visible in the self service view (cms portal) when the call is not resolved or closed (this can be regardless of role because the role holders do not update from this end anyway)



I want the button to be not visible in the self service view (cms portal) when the call is resolved or closed (this can be regardless of role because the role holders do not update from this end anyway)


I would just spell it out in a script include and call that. Easier to read and maintain.



Conditions: userCanEdit(current);



Create a script include:



function userCanEdit(gr) {


        if (!current.active) {


                  return false;


        }



        if (current.state == 2) { // replace with your Resolved state value


                  if (gs.hasRole("itil")) {


                            return true;


                  } else {


                            return false;


                  }


        }


}


abhishekdash
ServiceNow Employee
ServiceNow Employee

Hello Damian,



Can you try adding the below condition in the UI Action:



current.incident_state != 7 || current.incident_state !=6




Screen Shot 2017-11-06 at 9.21.21 AM.png



Thanks,


Abhishek



If this reply assisted you, please consider marking it Correct, Helpful, or Like it.


This helps other customers to learn from your thread.