- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
Note: This blog post reflects my own personal views and do not necessarily reflect the views of my employer, Accenture.
There are a lot of things that are great about Service Portal, but the way widgets are implemented is one of my favorites. In this blog post I want to call out Widget Options, which help to make widgets more dynamic and reusable, and talk about some ways that you can use them.
For an example, if we look at the default Service Portal homepage we'll see 4 columns across the middle for Order Something, Knowledge Base, Get Help, and Community.

What is not immediately obvious is that those are 4 different instances of the same widget, Icon Link. If you go in and ctrl+right click on the order something widget instance and choose Instance Options you'll get a modal with 8 different widget options you can configure.

This allows us to reuse the same widget multiple times without having to rewrite code, and allows someone to customize these widgets without writing any code. Lets take a look at how the widget is written and see how these options are referenced.

You can see that there are many places in the html where the options values are referenced and used in order to render the widget instance. You're not limited to the HTML field either as you can reference the options from the Server and Client script fields as well. Here are a couple of links that give some more details on how that works:
documentation/widget_options.md at master · service-portal/documentation · GitHub
Good practice: In addition to making it easier to use the service portal without writing code, one of the things I always think about when I'm writing widgets is how I might be able to use the widget options to have to duplicate less code and write fewer widgets. For example, if you wanted to add multiple lists of records to a portal page that was structured similarly for all of them, you could pass the table you're querying, an encoded query, and the field values you want to display through the widget options.
I'd really like to hear of some creative ways others have used the widget options in the comments on this post.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
