Custom Context Menu Options

serviceportal

As most of you know, Service Portal has a pretty handy context menu that you can access by simply holding down CTRL and clicking (right click on PC) on a widget. The context menu provides several shortcuts to some of the frequently used configuration options.

Note: the “sp_admin” role is required to see the context menu.

untitled-design-5

Adding custom context menu items

But did you know you can also add your own options to the list?

Open up the Widget Editor and insert the following JavaScript into the Client Script field.

Now when you view the widget in the portal and you open the context menu, you will see your newly configured menu items.

untitled-design-4

6 comments

  1. Sounds very interesting! Thank you for that hint!

    Can anyone explain to me what i18n.getMessage does? I see that it is injected in to the Client Controller.
    Can it be used similar to gs.getMessage to translate messages? It seams to be a synchronous function, right?

    1. i18n is shorthand for internationalization. I believe this service performs similarly to the server side gs.getMessage().

  2. Is there any way to get a custom menu like this for a widget inside a widget?
    E.g. a widget within a Macro variable on a catalog item

    Whenever I log the $scope or $scope.data it always relates to the scope of the entire catalog item, and I have to fish through all the variables to find my particular widget.

    1. I don’t think this is possible. You would need to add the options to the parent widget and then pass it through to the embedded widget.

  3. Hi ,
    Its very interesting. Awesome info. Same way is it possible to add approve , resolve, reject options as well.. like when user clicks resolve then it should resolve the incident .. same way for approve, reject?

Leave a Reply to Nathan Firth Cancel reply

Your email address will not be published. Required fields are marked *