WHAT IS “OUT OF BOX”
One of the most common requests we hear when developing a portal is, “stay close to out-of-box”. People usually think this means staying close to the look and feel of the Stock theme, in hopes that it will minimize complications with future upgrades. This common misconception has very little to do with the portal theme, and everything to do with how many and which widgets were cloned.
Staying out-of-box has nothing to do with the theming, look or feel of the portal, but how many of the widgets were cloned.
The real danger of “stay close to out-of-box” is that it leaves little-to-no room for:
- Adhering to company required branding guidelines
- Delivering a delightful user experience
- Meeting business requirements
So how do you stay close to out-of-box and ensure a smooth upgrade process without sacrificing the look, feel and functionality of the portal? In this article, we’ll outline various approaches to help you deliver a portal without sacrificing the user experience.
WHAT NOT TO CLONE
Before we talk about what you can safely change, let’s talk about what you shouldn’t change. Changing a ServiceNow widget involves cloning it.
When you clone a widget, you become responsible for ensuring your widget continues to function as expected after a ServiceNow upgrade.
If a widget with complex logic is cloned and you want to align it with the recent upgrade, you may need to analyze both original and cloned widgets line-by-line to determine what changed and to ensure nothing has stopped working. We know from experience that some widgets tend to change quite often, even within patches and hot fixes! For that reason, we recommend that you avoid cloning any widget with complex logic.
Some examples include:
- Shopping cart
- Catalog item
- Order guide
- Data table
Before you clone a widget, consider the additional effort it will require to maintain the widget with each upgrade. In many cases, with a little creativity, it is possible to meet business or branding requirements without cloning.
WAYS TO AVOID CLONING A WIDGET
We’ve found quite a few ways to avoid cloning while still meeting requirements. Here are some suggestions in a rough order of difficulty.
- INSTANCE OPTIONS
Many widgets already have instance options for configuring the behavior and look of the widget. You can access the options by pressing CTRL + Click on the widget and selecting “Instance Options.”
Making changes to CSS outside of a widget will have minimal impact on your ability to upgrade. Same thing applies to your layout. With this in mind, don’t be afraid to style and theme your portal to make it more attractive and “on brand.”
- WRAPPING/EMBEDDING WIDGETS
In some cases, you just need to augment or slightly modify the behavior of a widget. By embedding a standard widget in a custom one, you take advantage of the standard functionality while gaining the control you need. This is useful, for example, when you need finer control over the instance options that are passed to the standard widget or when you need to adapt URL parameters or events.
From Angular.js documentation:
“At a high level, directives are markers on a DOM element (such as an attribute, element name, comment or CSS class) that tell AngularJS’s HTML compiler ($compile) to attach a specified behavior to that DOM element (e.g. via event listeners), or even to transform the DOM element and its children.”
In simpler terms, a directive could allow you to attach behavior to DOM elements inside a widget you don’t “own.” This is an extremely powerful way to adapt widgets without cloning them. While diving into directive development is beyond the scope of this article, keep it in mind as you evaluate your options.
IF YOU NEED TO CLONE
In some situations, you can’t always avoid cloning to achieve the result you want.
If that is the case, be sure you:
- Document the cloned widgets
- Consider analysis time as part of your upgrade validation process
- After an upgrade, evaluate the source widgets to determine if you should
- Keep the clone “as-is”
- Upgrade it
- Revert back to the original
Remember, Service Portal is a UI framework built to help you create great experiences. Don’t be afraid to deviate from the Stock theme and take full advantage of all its capabilities!
For related information on the topic, check out these articles.
Widget Cloning — Clone a Widget