Skip navigation
1 2 Previous Next

Developer Community

23 Posts authored by: Göran Lundqvist

The Treasure hunt is back on. Earlier this year we had the hidden diamonds of Jakarta(LINK) and now it's time for the lost treasure of Kingston.


For those who find the hidden diamonds of Jakarta, my main thoughts here is to highlight the new features in Kingston that might not have gotten the same amount of star power as for example Flow Designer or the entrance of AI.

Before I start, I must say thou that my personal favorite is the Flow designer. I really like it and I think it can really be a game changer when it comes to slim your process, have better performance, less coding and the potential of re-usability within the designer is huge.


AI is of course also really cool, but in Kingston it's still in it's cradle, but I think it will unleech it's true self (hopefully we dont all die ) in London.


So, back to the lost treasures. First I want to mention two things that ServiceNow has buried so deep in Kingston, that those functionalities is long gone and I don't have any treasure maps to find them


  • UI11: I'm guessing many of you don't even know about this. I myself started my journey on Eureka where UI14 came, so I haven't even used it myself. Until Kingston, you could have lived in past and still using UI11, but in Kingston, it's gone.
  • Next thing that also has vanished is the ability to hold "Shift" and hover over the "i" in the list meny to get a popup window with the record in edit mode.


Now for the fun part:


Service Catalog in Service Portal:

There coming a whole new bunch of widgets and other fun stuff. The Service Catalog gets whole bunch of loving and for example our beloved Order guide now gets support for attachments; even per item. And as you can see for the order guide, it reminds a lot of the view we got in the native UI.


You can read more about it here:


Automated Test Framework (ATF):

I haven't have have time to look deep into ATF as I want. But I can see that one things that I would really love if I used ATF, is the new feature to be able to rerun specific failed tests in a suite without need to rerun the whole suite.

You can read more about it here:



he CMDB SDK provides a set of Representational State Transfer (REST) application programming interfaces (APIs) that enable third-party applications to use the identification and reconciliation engine to create, read, and update configuration item (CI) records. Thus, eliminating duplicate CIs and improving overall CMDB data quality.


So hopefully this will lighten up the life the CMDB people when it comes to make sure there isn't duplicate Cis etc.


You can read more about that and more CMDB news here:



In Kingston we see a few of these workspaces (not sure of the official label). In my eyes there are the future and I bet in London these will have grown and taking over a lot more applications. If you want to see how it works, take for example a look at the Agile Board. (You need to activate the agile 2.0 plugin to get it).


You can read more about the agile board here:


Software Asset Management (SDM):

In Kingston there will be OOB integration to handle your Office365 subscriptions. I think there is a lot of money for companies to be saved in all kind of licenses and Office365 sure is a place there has saving potential as well.


You can read more about it here:


Performance Analytics:

Now you have the ability to use External Data sources to pull information from to your PA reports. Real simple and no data is saved in ServiceNow, only the scores is saved in ServiceNow.


You can read more about it here:


Function fields:

A new field type has become reality in Kingston. With this field you can do let it show the result of a database function like for example add, concat or datediff. And by doing this here instead of a business rule, you should get a lot better performance. So together with the Flow designer, I think we will see a lot less use of business rules in the future than we have seen in the past.


You can read more about it here:


And for last,


Mobile App

The mobile app is really starting to evolve and now there is functionality for user to still be able to use the app even if they doesn't have an internet connection. I think this is a real nice feature and probably wanted by many.

You can read more about it here:

Good luck on the treasure hunt!




sn-community-mvp.pngSymfoni Logo Color Box.jpg


ServiceNow Witch Doctor and MVP
For all my blog posts:

So, this time I my journey took me into the Service Portal and the widgets. This time I was looking at a knowledge article within the portal and wonder who I can make the picture bigger if I clicked on it. To be able to achieve that I took use of the functionality called Link function which you can see in the widget editor. I can easily say that I never used that before so I wasn't really sure how to use it and what it really was for.

I took a look at the documentation and what I could find out was that I used Link Function to directly manipulate the DOM (Link Docs). And this was pretty much what I was after. To manipulate the pictures in the articles so if I click on them, I would get a enlarged version.


I made a video here showing what I did and how I did it.



So grab a cup of coffee and enjoy.



Symfoni Logo Color Box.jpgsn-community-mvp.png


ServiceNow Witch Doctor and MVP
For all my blog posts:

If you been working with Order guides you know that there is room for improvement on how it works in ServiceNow. I've been looking into this in the view of that a requirement was to set a SLA on the order guide it self. Not on a specific item connecting to it, but the whole "request". Problem here was that on the request, you can't see from which order guide it was generated from or even if it was generated from a order guide or not.


So I made this video showing you how you can to do make this reality. It doesn't require so many steps and hopefully it will be useful to a lot of people out there and making you come up with your own areas to use this.





Symfoni Logo Color Box.jpgsn-community-mvp.png


ServiceNow Witch Doctor and MVP
For all my blog posts:

This is a old post I had on my earlier blog. I thought I might as well bring it up here to try to clear out how the cloning works.


First let's just talk about how the cloning works in a light version:


  1. You request the cloning with the System clone->Request Clone. Remember that the data you are cloning are from last night backup. So if you just changed something, you have to set the clone date for tomorrow instead if you want your last changes to be cloned.
  2. Now it looks at the "Preserve data" table and see what data on the target it should save. The data is stored somewhere else(magically) and will be restored after the clone
  3. Copies over everything to the target. If the table is in the "exclude tables" it only copies over an empty table.
  4. Then it copies over the "preserved data" that was stored before the copy.
  5. Runs the post-clone cleanup scripts.



How to save data on the target:


System Clone->Preserve Data. Here you specify which data you want to save on the target. You can take a whole table or you can set conditions like everywhere else in ServiceNow to just get a specific records from a table.


Now, preserve data does one thing, and that is make sure that the data on the target exists after the clone. It doesn't stop data from the source to be copied over. So if you only fill in the "Preserve Data". It will have data from both the source and the target. Example is the table "update sources" which holds information from which instance you get your updates from. If you put that table in "Preserve Data" it will keep your target source, but it will also copy over the sources "update sources". In real life this will probably look like if  you clone production to test, you suddenly have the productions update sources, which is test...


So what you need to do is to put the table in the "exclude tables" as well. Then it will first only copy over an empty table, then copy back the preserved data from the target.


The "Exclude audit and log data" checkbox:


There is also one checkbox I want to talk about and it's "Exclude audit and log data". This checkbox is checked as default and will stop a huge chuck of data to be copied over. And most of the time it's not needed. But it means for example that workflows isn't copied over, so if you after the clone go look into change requests that were copied over, they won't have a workflow connected to them. And that also means for example that the UI Action "Show workflow" isn't visible. It also excludes the audit data which means that the activity log for those records are messed up with time stamps and so.  The fix for this is of course to uncheck the field, but unless you have good reason to do this and copy over an extra large amount of data, I recommend not to do it. Since you should still be testing with new records/tickets anyway to see that it all works as intended.


If you want to dig deeper into it, feel free to visit the documentation: System clone




sn-community-mvp.pngSymfoni Logo Color Box.jpg


ServiceNow Witch Doctor and MVP
For all my blog posts:

I Guess by now that you have both seen and heard a lot of the new cool feature of Jakarta and what you can expect from upgrading to Jakarta. So this post isn't going to be about all those new big things like Software Asset Management and so on. I have spend some time digging around in documentation and playing around in the instance to see what have been put in there without any big notice or any drumbeats.


First out is Automated Test Framework(ATF). It can with Istanbul and gave us all a good ground to stand on and start doing automated testing. what was missing there was that it all had to be started/runned manually. Not anymore =) In Jakarta they have introduced the possibility to schedule test suite executions. It will make life even better and you can OOB schedule notifications with results etc. as well. Only downside atm. is that if you have tests that involves client stuff like adding values in a form field, you will need to have a browser open with the "Scheduled Client Test Runner" so the client side will be tested there. But still automated, so only manually thing is it leave a tab with that open.

Read more about it here: Schedule automated test suite


Next stop will be Knowledge. Knowledge got a few good things in Jakarta and here are two of those that I want to highlight.

  • Article Versioning: Now you can have your articles with version. Giving your good opportunities to rollback and even work on a article without messing with the public one. I really enjoy this. Can read more about it here: Article versioning
  • Different View in Service Portal: With Jakarta there have come a own Knowledge Portal. I might not really see the use case here atm. I think this is just another brick in the game to mve a lot of the functionality from the normal "UI" to a Service Portal design instead. But the portal looks pretty much like if you go to knowledge within the normal "UI" which has much better filtering etc. And here it now gives up a some widget that we can take and reuse on our own portal page =)
    It looks something like this:

And you can read about the knowledge portal here:

Knowledge Management Service Portal


Here is a very little thing, but I really like it. Don't we all hate when small images like signature etc. in the mail becomes attachments in the ticket. Now there is a property for this you can set how big a image must be for ServiceNow to add it as a attachment. Is it below the value, ServiceNow will ignore it. You can read more about that here: Email image filtering properties


Variables belonging in the Service Catalog has gotten a nice feature. To be able to put in Placeholder in the field of the different variable. Now we can move some of the help texts to inside the field and give a nicer look. This will work both in the normal "UI" and in Service Portal view. Why they didn't name the field "Placeholder" I can't say, but the name in SeviceNow is "Example Text". and it's working on the following variable types:

  • IP Address
  • Email
  • URL
  • Single Line Text
  • Wide Single Line Text
  • Multi Line Text
  • Date
  • Date/Time


For last we have the Service Portal. I would like to put up two nice things that has been added here, even if there is a lot to choose from.

  • Draft: It is now possible to put a page in "draft" mode so it isn't visible for the end user the second you save it for the first time. Even if it's a nice feature, there might be some disadvantages of this You will find this choice in the "Edit Page Properties" in the designer:
  • Variable types: Many people may have noticed that if you went into the docs for variable types and earlier releases, most of the have a text like this:

    But now, "all" variable types are supported on Service Portal, beside those who are using Jelly. But that is pretty obvious. One thing I noticed thou is that even if they are supported, they still don't always have the same functionality as in the normal "UI". Example container which in the normal "UI" has a +/- to expand & collapse the variables inside, they still don't have that functionality in Jakarta. But they are supported at least


Well, this was a few of the hidden diamonds I found so far in Jakarta. Feel free to comment if you have something you want me to put in the list here and I'll add it.




Symfoni Logo Color Box.jpgsn-community-mvp.png


ServiceNow Witch Doctor and MVP
For all my blog posts:

Sitting here at the table, trying to take in all the emotions and knowledge that was gathered in Knowledge 17. It's been a ride, and sadly not enough time to meet everyone I wanted to meet.


Remember also that this is written when comparing to Istanbul release.


I held a round table about what obstacles you might run into when moving from CMS to Service Portal and some solutions for them. Since I didn't have any PowerPoint or similar, I promised to do a blog post about my findings. And before moving on. This is not a post about all nice features of Service Portal. I'm only highlighting the issues that you might run into moving from CMS to Service Portal.


I would also recommend that you try to see the move as a "portal 2.0" and not just a clone from CMS to Service Portal. You got a totally different tool set at your disposal, so be sure that you know what it can do so you don't miss a great opportunity to take you portal to the next level.


Beneath I will mention something I call "normal" UI and compare it to Service Portal. When I talk about Service Catalog and "normal" UI I'm talking about this:



General things:

  • Is there a migration tool or a clear path?
    • Nope, sadly not. No one button to press. The path isn't so clear either and depending how customized/complex you CMS portal is, you got a quick migration or a very tough one.
  • Do I still need to know Jelly?
    • It's gone, for the positive side, most of all see this as a real nice thing. But it also gives you a real headache if you have done a lot of customization in Jelly. all these needs to be redone for the portal. I recommend that you first of all go through the functionalities that exists in OOB widgets, and go from there. Remember that there is many more OOB widgets in Istanbul than Helsinki and I bet there will be even more/better ones in Jakarta that is coming out soon. Also remember that the variable type "Macro" has a UI Macro connected to it, and that will of course not work since it uses Jelly. A little more about it further down in the Service Catalog section.


  • How does it work with mobile devices and this "responsive" pages people are talking about?
    • Yes, Service Portal has the responsive/mobile in it's mind. You will easy get a portal that renders the pages after what device/resolution is used to access the portal.


  • Iframes, do we use them in the portal?
    • You might need it still for some more complex stuff. But for easier things like lists, forms etc. there are even OOB widgets to handle these.


  • Dynamic blocks then with my nice layout and code?
    • Nope, you will need to redo all this. most of the stuff is in Jelly and the other stuff is mainly built in widgets. Some code might be reusable in the Server Scripting and for example CSS.


  • I still use IE9 on my client computer!
    • Well, Service Portal needs new version than IE9 to get the angular to work. But there is other places in ServiceNow that also uses angular, which will give you problem. But I would also say that there is bigger problem than ServiceNow if clients still using IE9 which Microsoft stopped supporting quite a while ago.


  • How about the URL, will that be the same?
    • URL to the start page will be the same, if it's decided to keep it. For sub pages and stuff(ex. KB article) it will be changed. So if you got URLs referring to different parts of you CMS, these needs to be updated. Also remembers you might has notifications etc. that has a link that isn't correct for the Service Portal.


  • Contextual search, I love it. Is it there?
    • Well, yes and no. From the start, it didn't work. Now there is a patch from HI to make it pretty good(Link here), but leave some room for improvements. No idea how it looks like in Jakarta. There is also a few versions of this done by other companies, but haven't seen anyone for free yet.


  • We have multiple CMS sites for different users, can I have that in Service Portal as well?
    • You can, OOB ServiceNow redirect all logged on "none role" users to one specific portal. This can be customized so depending on your parameters the user will get redirected to different portals. I wrote a quick post about it HERE. You can also make a more clever portal that just changes looks depending on the user as well. A bit more complex, but might be the correct way to go.


Service Catalog:

  • I heard there is only one Catalog per Portal, is that true?
    • Yes, that is true. OOB there is only support for one portal. Here you need to think of how the design for the whole enterprise would look like. Should you have multiple portal and more "OOB" or should you start customize OOB Widgets to handle more than one catalog? There are both pros and cons for both solutions and I think there is probably a couple of hydrid version etc. as well of the two examples I have. Example with multiple Portals is that the search will only be in the specific portal the user is at. Istanbul has added "search sources" which gives your the opportunity to make the search go outside the specific portal and can be uses to search in multiple. But when you want the user to be able to browse multiple catalogs at the same time, you need to customize the OOB widgets for displaying this.


  • You mention variable types about, is there more to know?
    • Yes, there is quite a few things here:
      • Macro: As I mention above, in CMS you could have UI Macros connected to the Macro variable. They don't work in Service Portal since it doesn't support Jelly. A good thing is thou that the variable now has a widget field where you can redo the same functionality in a widget and connect it to the same macro. What to remember here is that if you got variables that are going to be used on items that are used on both Service Portal and the "normal" UI, you need both UI Macro and Widget. This since the Widget won't work in the "normal" UI and vice versa. Which means you perhaps should think of having fullfillers etc. also use the catalog in the Service Portal "view" instead of maintaining both a widget and UI Macro.
      • Other Variable types: Variables behave different depending on they are shown in the Service Portal or the "normal" UI. For example in the "normal" UI you can use a container to expand/collapse the variables inside the container like this:

        And on Service Portal the option to expand/collapse is gone and you also see the thin gray line is gone as well:

        If you go to the documentation for variable types you can see that some types has the text "The Xxxx variable is yet not supported on service portal and mobile devices". This doesn't mean that it don't work at all, but it might have a different look or functionality.

      • Help Text: There are also other things that behave different and the help text is one of them. In the "normal" UI it is a nice expand/collapse feature with some blue background like this:

        and on Service Portal it is suddenly a grayed out text like this:
  • So, how about Order Guides?
    • Order Guides works like they should, besides the variable type issue mention above. But there is one major change when comparing to the "normal" UI and it's the layout. "Normal" UI has a tabbed format of the Order Guide while the OOB widget has all items in a vertical row.

  • Do I need to do anything with my Catalog Client Scripts & Catalog UI Policies?
    • You probably will. Simple stuff will probably work, but there is a few things to think about:
      • UI Type needs to be set to either "All" or "Mobile / Service Portal". If not, it won't load in the Service Portal. But switching over to "mobile" also means that for example your GlideForm API get reduced since the mobile version doesn't have all the nice features the normal one has. Here is a link to the Mobile GlideForm API
      • DOM Manipulation using stuff like $, jQuery doesn't work and need to be replaced. Same thing goes for getControl, getElement etc.
      • If you got some variable sets that all items use. Perhaps it's an idea to put this into the widget it self. Always make sure it's what you really want and need.


  • So, how do I test if the things work?
    • Well, first of all. Don't use the "Try it" button. Things might work when you go test through the "normal" UI but not in the Service Portal. Then you have the other way around as well, since variable type macro with widgets won't work in the "normal" UI..
      Then of course since client scripts and UI Polices works different depending on how you access them, test them on the places they will be used. And do that also since the variables them self might look difference depending on where you access them as well.



  • Only one Knowledge per portal as well?
    • Yes, here is just the same issue as for the Catalogs with the same thoughts and pros & cons.

  • How about public Knowledge, is that doable?
    • With Service Portal it's a lot easier to have a knowledge public(user not needed to login to search it)

  • Where did copy permanlink go?
    • It's gone. But on the other hand you can easy just copy the URL from the browser instead. Just remember that if you have old links to the knowledge base, they won't point to the new Service Portal.


Thats about what I have for the session and what came up while we talk. If you got more things, please post it in the comments and I'll add it.




sn-community-mvp.pngSymfoni Logo Color Box.jpg


ServiceNow Witch Doctor and MVP
For all my blog posts:

By default, all end users logging in can be redirected to a specific portal. OOB this is the portal with the suffix "sp".


Many users has risen the demand to be able to redirect end users to different portal depending on specific parameters. In this post I will give you a simple example how to redirect the end user to a different portal depending on which company they belong to. I believe that after this, you should be able to use the same way to setup your own conditions and reuse the rest of the code.


So sit back, get your coffee and press play =)





Symfoni Logo Color Box.jpgsn-community-mvp.png


ServiceNow Witch Doctor and MVP
For all my blog posts:

This Dilemma is coming from a community member who was asked to put in a "confirm message" to a user where they had filled in information on a catalog item in the Service Portal and tried to move away from the page before "saving" it. We are talking pretty much the same functionality like we have on for example the incident form.


Before I continue, I would like to do a shout out to Nabil & Jace(jacebenson) at our slack channel ( for helping me getting the last pieces together.


I was going to record this as a video, but google seems to be messing with hangout so that wasn't possible, so bare with me. There can be a few screen shot coming this way.


So, we are looking at the page OOB "sc_cat_item" in the Service Portal.


It looks something like this when you selected an item:


If I press back now or reload, the page will just do that without caring that there is info in a form that hasn't been saved.


So we need to customized the widget that are showing the catalog item. First thing is to clone that widget.

For those who doesn't know, you can "CTRL+right click" on the widget to get a menu like this and where you can easy go to the widget editor.

Now, we can't edit OOB widgets, so we need to clone the widget first to be able to edit it.

Choose a new name and we are almost ready. Remember when you cloned, the cloned version doesn't load in the widget editor automatically.


Now we need to put our widget on the page before we start to do anything. Easier for testing and not so much confusion when you think you have change it later on..

This widget is kind of weird, since when you go to page through designer mode, you will not see it there, but it is there..

I would say this is kind of buggy and there is different ways of removing it, you can for example go through the page editor, there it is visible like here:


Anyway, I usually just mark the whole container, deletes it and then put in a new container, a 12 "column" and then my widget in there.

Then you can go back to your catalog page, reload it and when you "CTRL-right click" you should see your new widget name there.


So, open up your widget in the editor so we can do the real magic.


Before we start there might be some other way as well, I'm no Uber coder, but at least I got it to work =)

We need to do the following:


1. Add a name to the form that is holding the first. This is since angular is putting a variable on the form if it contains data that isn't saved and it's called $dirty. So if form-name.$dirty == true, it has unchanged data. I found on my world tour of google some example for angular to handle this, but couldn't get it real to work. In this example I name the form "c.myCatTest". if I just named it "myCatTest" I couldn't get it to work even if I should get it. So the only change in html template is this on line 21:


Then we need to do some client script as well. Now, you can put this pretty much where you want, but I put it here between line 62 & 74:


Now, This is two parts. The $scope.$on('$locationChangeStart'.... should be enough if I read the docs correctly,

but that triggers only if the user presses the back-button or presses on another link on the page, like breadcrumbs, menu etc.

I also tried here to change my code on line 64 to if ($scope.myCatTest.$dirty) when I named my form to "myCatTest" but couldn't get it to work, this works at least =)



The second part $window.onbeforeunload.... handles if the use trying to write in a URL manually or hit the reload button.
It doesn't care about the back-button....Se we need both.


So with this code you now should be able to save, reload the catalog form on the portal and you should need to confirm if you have some unsaved data and try to leave.



Links for more info:

$dirty ->

$locationChangeStart ->$location

$windows.onbeforeunload ->


Hope this will save some time for other people as well.




Symfoni Logo Color Box.jpgsn-community-mvp.png


ServiceNow Witch Doctor and MVP
For all my blog posts:

I wrote about this on my own blog for some month ago and I think it still is valid after reading post at the forum. So for some it is old news and for some it's new news =)


The more I read about Business rules I notice that they are being used the wrong way by many people. Every rule has it's exceptions and I bet there is one here as well. But I can say that I haven't yet come up to a reason why you should use current.update in a Business Rule. I written a post about this and Business rules in general.



I guess I need to explain what I mean with my headline.


I like this picture from the Wiki




It's pretty simple if you look at it. Let's go through what kind of business rules (BR) we have.



This type of BR is used to modify the queries that are send to the database and this is before any data is collected, which means you can't do things like "if (" since the BR have no idea what value has. You pretty much use query BR to restrict what kind of data that the user is allowed to see.



Table: Incident

Condition: !gs.hasRole("admin")

Script: current.addActiceQuery();


What will happen here is that if the user query the incident table and don't have the role admin, it will add "current.addActiveQuery(); to the query and the user will only get back records that are active.

Here we can see that we shouldn't use current.update to anything.



So what can we use the Display BR to? Well, if we know that we will need data to use in a client script, but the data isn't available in the form. The we can use the display BR to run server script and put the info in the g_scratchpad and then use it later in the client script. Just be careful, since it put the data in the scratchpad when the form is loading, that also means that if then the use don't do anything for like 10 min and the do something and the client script uses that data. It might be old and not correct. If you instead use a Ajax call, you will get "live" data for your client script.


So current.update shouldn't be used here either.



Now this BR hits before the data is saved into the database. But since the data hasn't been saved, we don't need to use the current.update here either since the record is about to be updated automatically. Here we can modify fields like current.u_no_idea = 'bad imagination';


We can also use a before BR to validate the information to check if it should be allowed to be saved. Doing this here instead having a client script doing it. If the data isn't correct, you can abort the action with current.setAbortAction(true);


I know I'm repeating myself, but no use for current.update here either



Looking at the picture you can see that the BR runs after the data has been saved to the database. Now is a perfect place to update other records beside the current one. Yes, you have access to the current object, but that is more to be able to use this data to do conditions and for example IF-statements to decide what other records to update.


Which leads to that we don't use  current.update here. What will happen if we use current.update? All the "before" BR will run again, since we are trying to save/update something in the database... And again, is there anything in the current object we can't do in a before BR? that we need to do in a after? Right now I'm saying no until someone else corrects me.



Looking at all of the above, we are hitting user experience, making big BR of any kind of the above will affect the user experience. Even a after BR doesn't let the user do anything else until it's finished. That leaves us to the last one.



Async BR is something that I myself probably could use more instead of the after BR. I have a note on my desk to go through all my BR's when I got time over to see if I can move over some after to async. Async (Asynchronous) is simular to after BR but here it let's the user go and do other stuff and put this on the "let's do it when we got time" list. If the condition on the async BR hits true, it understands that there is work to do and creates a schedule job to handle all that work. it's schedule to run immediately, but it doesn't guarantee when it's finished.

What's good to know that the BR isn't run within the user's own active session. When the schedule job is ready to go, it impersonate the user and a new session is created for this job. This will probably not have any affect, but can be good to know. So if you got things that needs to get updated after a record is saved and not in a extremely time critical way, async is the way to go.

But then again, it's only different from a after BR is that the user doesn't need to wait for it to finish.


And guess what... We don't do current.update here either



So, that all about Business rules and I have at least not found any way of having the need of current.update in a BR.




Symfoni Logo Color Box.jpgsn-community-mvp.png


ServiceNow Witch Doctor and MVP
For all my blog posts:

I've seen a lot of questions on the community where people would like to for example set a specific number of attachments as mandatory before the end user can submit the order.


Of course this can be done in more than one way, but here I'm showing a way where you as a sys admin or developer can leave the future configuration to the catalog admins. You don't need to do anything if they want to change the amount of attachment on an item or remove it. They can do it them self.


I basically just do 2 things:


1. Add a new field to the sc_cat_item table to handle the amount of attachment the limit should be.

2. I copy the widget SC Catalog Item and modify it to handle this functionality when the user submits.


So here is the video and I'm sorry about the quality, but I thought it was going to record in HD, but after I don't have time to record a new 30 min video But if there is anything you wonder about, just let me know.



Take care,




sn-community-mvp.pngSymfoni Logo Color Box.jpg


ServiceNow Witch Doctor and MVP
For all my blog posts:

I wrote this on my personal blog before ending that and start writing here. I noticed that people still wonder about this and thought I might as well post it here.

This started from a community question which was how you could check if the valid to date is 30 days from now and then send a notification to the KB managers.


Now. The functionality that was wanted: When valid date is 30 days from now, the KB Managers should receive an email notification about it.

This can be solved with a schedule job which runs once a day and triggers an event for each KB article that matches the conditions and finally a notification is trigger of that event.


1. Register the event

First we need to register the event that we are going to put in the queue. This is done by going to the System Policy->Events->Registry.

Here we create a new event that looks like this:



That was pretty easy, so let's head to the list view to get the encoded query.


2. Encoded Query

Quickest way is just to type kb_knowledge.list in the navigator and you get the to the list view of the KB articles. Set up the conditions and when you're done, right click and copy the query.



3. Scheduled Job


Now we need to create the scheduled job which should once every day to see if there is any knowledge articles which is get close to the valid to date. This job goes through the encoded query and for each record it finds that matches the query it will fire of an event so the notifications can be sent. It looks like this and the code is below the picture.



var gr = new GlideRecord('kb_knowledge');





while ( {

gs.eventQueue("knowledge.expiring", gr);



As you can see in the gs.eventQueue we only have "gs.eventQueue("knowledge.expiring", gr)" in many cases you also specify parameters 1 & 2 like this: "gs.eventQueue(“incident.commented”, current, gs.getUserID(), gs.getUserName());". But since we don't need those, we just skip them.


4. Notification

Now we only have the notification left. Its pretty, simple. set that it will fire on the event and specify who will recieve it and finally the text for the notification. I'm just showing the section with the "when". The rest is purely case specified, but if there is any questions about it, just post a comment and I'll get back to you.



Well, that it. =)





Symfoni Logo Color Box.jpgsn-community-mvp.png


ServiceNow Witch Doctor and MVP
For all my blog posts:

I found this question on the community where they were looking for a solution to close the ticket after 3 business days. As we all know, for example the "autoclose" for incident doesn't count business days, it just goes for "days". Which pretty much leaves people setting a high value enough so it would take care most of the short holidays and the customers won't be angry. This solution can be used on all kind of tickets.


EDIT: I also put this as an "idea" on the community, so go in and vote for it and see if we can get it into a future release: Be able to use Business hours/days to autoclose ticket


I will use the following stuff to get it to work:


  • Relative Durations. I use this to set the amount of business days I want it to wait until it closes. Using relative duration
  • DurationCalculator. To calculate the duration with a schedule. Using DurationCalculator to calculate a due date
  • Schedule Job. Then I'll put the code in a schedule job that runs how often you want it to run to check and close those tickets that are "due".



First step is to create a relative duration that fits the amount of days you want. You can easy find it under System Scheduler->Schedules->Relative Durations.

As you can see there are a few examples that you can either use or look to understand how it's build up.

But lets create a new one that we want to be "3 business days". It doesn't need to be more than this:

Copy the sys_id of this record, since you will be needing it later for the coding of the schedule job.


Next step will just to get the sys_id of the schedule you want to use. Just head to the schedule record and copy that sys_id as well.


Now we got all the nice things we need. So lets head to System Definition->Scheduled Job and press New. Choose "Automatically run a script of your choosing" and we get to the new record.

Here you can set how often you want it to run, but perhaps once a day would be nice and let's pick a time when we don't think so many people are working.

Remember to put all your code in an anonymous function so it variable etc. doesn't get messed up with other things that is running. If you don't do this, strange things can happen if you for example have two jobs running at the same time and both having a variable called for example gr.


Summary of the code below.

  • Get the sys_id for the relative duration I want to use
  • Query all the records I want to go through. Active is true and got a resolve date is the ones I want here.
  • Loop through the records I get and check if its been more than 3 business days since it was set to resolve. If it is, close it.


  //Get the relative duration for 3 business days
  var relDur = 'f3ae5fc70f0132004cf365ba32050eb9';
  //get the incidents that we want to go through
  var encQue = 'active=true^resolved_atISNOTEMPTY';

  var gr = new GlideRecord('incident');

  //Calculate and see if resolve date is more than 3 business days ago. And if, close the ticket.
  var dc = new DurationCalculator();

  //Load the schedule into our calculation through the function below

  //Do the calculation and see if end date is before today
  if (!dc.calcRelativeDuration(relDur)) {
  gs.error("*** calcRelativeDuration failed for record {0}", gr.number);
  if (dc.getEndDateTime() < gs.nowDateTime()){
  gr.setValue('state', 7);

  function addSchedule(durationCalculator) {
  //  Load the "8-5 weekdays" schedule into our duration calculator.
  var scheduleName = "8-5 weekdays";
  var grSched = new GlideRecord('cmn_schedule');
  grSched.addQuery('name', scheduleName);
  if (! {
  gs.error("*** Could not find schedule {0}.", scheduleName);
  return durationCalculator.setSchedule(grSched.getUniqueValue(), "GMT");



That it, I hope it can give some ideas how to use the duration calculator for more fun stuff.





Symfoni Logo Color Box.jpgsn-community-mvp.png


ServiceNow Witch Doctor and MVP
For all my blog posts:

I just stumbled over a new Security restraint that I never noticed before. I had a user that had the role “user_admin” so they could do some standard admin stuff.
Now with the role, you have the “groups” module and in that, you can press “new”. Here you put in your data and press save, unless you want to add a type.


Then this happens…




That was kind of a bummer. But my guess was some kind of ACL so I put on my superhero cape and started to debug security.

I was expecting a page with at least ONE red row with ACL to confirm that I was right on track, but this is what I got.


acl 2 all green.JPG


I see the “Security constrains prevent access to requested page”. However, it is all green and after another look.

I can see that there is not any ACL at all. This should be your “red flag”.

I remember the days when I took the sys admin course, going through ACL for the first time and it was VERY complex, and I never thought I would understand it.

Nevertheless, I got that if it could not find an ACL for the specific table, it go downwards to the wildcard one etc.


And I have this beautiful picture in my head =)




Now, there is a * ACL, but it requires me to have the role admin to get access. But I do not see any red rows in my debug…

It all boils down to the Security settings. Default it has this setting under system properties-> Security



Meaning that if it doesn't have any ACL at all, it will be deny...
and it didn't have any.


So to fix this, I created a ACL and put in the role I wanted to be able to get access to the type.

And here you can see with the ACL Execution plan that it adds it just like we want =)



And when the user now goes in and clicks on type, it shows up.


ACL works.JPG



I hope this will help in the daily ACL work that we all love




sn-community-mvp.pngSymfoni Logo Color Box.jpg


ServiceNow Witch Doctor and MVP
For all my blog posts:

EDIT: *The UI Page "CodeSearchExampleUse" mention below doesn't work in Istanbul release, there you need atm. go through the studio*


I have been supposed to write this post for months now, and finally I got the time to do it.


I doubt I'm the only one being in the position where I forgot where I wrote a specific piece of code or that you can see that something is changing the data, but you can't figure out how/where.


Lucky for us, ServiceNow has a solution for us, you just need to search a bit to find it. The solution is named "Code Search". This been around for a while and it pretty much lets you easy search for a piece of code in a lot of places. After read what I could find in the docs, I would guess this is made primary for the ServiceNow Studio and I'll come back to that in the end of this post.


so, here is how to find it:


Code Search itself is an application and you can find it by going to "System Applications->Applications" in the navigator.


Then you need to click on "downloads" and there it appears in the list. You can click on it to get some more information about it.


Looking around in the records it has, you can see that it got a UI page called "CodeSearchExampleUse", let's look at it.




You can see its got a endpoint, so lets click on it and see how it looks like.


Just check the box "Search All Applications" and fill in what you looking for and tada, it gives you the result.

Here you can see that for example there is 2 client scripts having "setValue" within them. It also give us the client script name and even at which row it can be found.


Atm. I can see that it searches through:

  • Approval Steps
  • Inbound Email Actions
  • Style
  • Installation Exists
  • Client Script
  • Validation Script
  • Scheduled Script Execution
  • Relationship
  • Macro
  • UI Page
  • AJAX Script
  • Transform Script
  • Notification
  • MID Server Script Include
  • Access Control
  • Map Page
  • Workflow Activity Definition
  • Knowledge Nav-ons
  • Schedule Item
  • Table Transform Map
  • UI Script
  • Business Rule
  • Dynamic Content
  • Email Template
  • BSM Map Actions
  • Processor
  • Script Include
  • UI Action
  • UI Policy
  • Widget
  • Script Action


So it's quite the list and a real nice help to find stuff.


But it's some clicks to get to the search page and sadly there isn't an application with modules done for this. But you can make your own.


This is what I have done:

I've made my own application with modules that I use often and I put CodeSearch as one module. The module looks like this:


And just to show you what I meant with it exists in studio, this is where you will find it:



So there you go. I hope this will help you in the search of code as it has done for me.


Take care,



Symfoni Logo Color Box.jpgadvocate.jpg


ServiceNow Witch Doctor and MVP
For all my blog posts:



When the Helsinki release arrived we all saw Service Portal and what it can do. All our focus was on how it would help us move from the old CMS application to a brand new world with Service Portal. Giving us the widgets, AngularJS and other fun stuff. Which would make our life both easier and funnier.


After a while the mind started to wander away on what other functionality that could be possible with Service Portal and its pages. Lately I have noticed that I haven’t been alone going in this direction when similar thinking has been popping up at the community. Some of the questions has been on what you can do with those pages and if it’s possible to display them inside the normal UI of ServiceNow. And of course this is something you can do it and you can do it pretty easy as well.


Before I had time to look into this any deeper Istanbul release came and now we are really starting to see the true power of Service Portal and what you can do with it.




The whole CAB Workbench is built within a Service Portal and I think it’s just the beginning. I think we will see more and more applications being build this way and beside the having it built as a own UI, I bet we will see more and more pages being displayed inside he normal UI, like this example I quickly made:



This is easy created with a Service Portal and a module with an URL link.


Looking at what ServiceNow has on it road map and what the rumors says, they are moving more and more into widgets and Service Portal. And it’s the right way in my opinion. Going away from UI Pages, means going away from Jelly. And neither we (users) nor ServiceNow is really happy about Jelly and seeing a road ahead which means less Jelly, I think we all will love to go down that road.


So in the future when I get to a requirement that in the past would have been a UI Page, I will first look if it’s possible to do as a Widget/Service Portal. If not, perhaps there would be another solution and a UI Page as a last solution.


The only place I can see there is a need for a UI Page is where you using the GlideDialogWindow. Here I can’t see any solution to replace it with something from the Service Portal, besides perhaps building the whole thing within the portal and that might be overdoing it and one of the places it isn’t worth the effort.


So to answer my question in the subject. I think that UI Pages will still exists for a few more releases, but we will see less and less of them. I hope this little article has gotten your ideas a new perspective and hopefully we will see some real creative solutions in the future with Service Portal.





advocate.jpgSymfoni-Logo-Color (1).png


ServiceNow Witch Doctor and MVP
For all my blog posts:

Filter Blog

By date: By tag: