Packing in a Little More Knowledge[18]
At this year's ServiceNow conference, Knowledge18, I’m attending the Advanced Service Portal pre-conference training. Not all trainings are created equally, and I’ve found this one to be quite useful so far. Here are a few best practices and other gems I’ve gleaned from it:
Widgets should perform a single function. Rather than trying to build a complex app through a single widget or otherwise over-complicating your designs, limit each widget to a single purpose and use multiple widgets to complete an experience on a given page.
Widgets should be re-usable as often as possible. To quote the instructor in this context, “Don’t hard-code anything.†Take advantage of the options schema to allow easy configuration of widgets, built for shared purposes with individual instances configured to suit the needs of a given context.
A widget is an AngularJS directive. While not necessarily practical in nature, it was interesting to understand widgets as directives as I’d never really thought about them in that way. But they are, so there you go.
Some API methods do not have scoped equivalents. When you’re creating a service portal for a scoped application, you may find yourself cloning widgets from the global scope. When you do, be sure to test early in your development as you may find that you need to do a bit of refactoring to account for methods that are no longer available, e.g. gs.log().
Once you clone it, you own it. With over 80 out-of-the-box widgets, look to configure an OOB option first before cloning and customizing or even building from the ground up. ServiceNow supports these widgets with upgrades as they do other portions of the platform. Once you've gone off on your own, that burden rests with you. Check out the docs site for a library of available widgets.
Be intentional in your use of the update() call from your controller object. You can make calls to the server with the get() method that are much less intensive than passing the entire object as happens when you call update(). Use update() only when you have a legitimate need, such as updating the majority of the fields on a given record.
Improve performance by using one-time bindings. Use the :: syntax before a binding to have it load only once. For data that won't often change, this helps the performance of your page.
ServiceNow developer
6 å¹´Just some addon from the last session on Thursday; ServiceNow is building Agent Workspace using their own, new, dev environment that will make it easier to implement new languages. A problem with SP is how bound it is to AngularJS 1; a plan is to start using the new method "seismic" for Portal widgets by containing the widget in an AngularJS frame. /Add long text about future features not set in stone.