TOTP (Time based One Time Password)

General No Comments »
by:


Make use of one-time passwords for several two-factor authentication systems.
Continue reading…»

Howto: Manage e-mail hyperlink to ServiceNow with a portal

General 1 Comment »
by:

The portal

You have created a beautiful portal in ServiceNow using CMS where your end users can log in, search for support, create tickets, chat with a service desk and keep track of their logged incidents or change requests. (BTW: If you want a nice portal please contact us, we can build great portals for you 😉 )

The problem we faced

If you send out an email notification when the user submits an incident or change request or there is an update on a ticket, you’d like to send a hyperlink in the email message. Now the user is able to quickly navigate to the ticket on the ServiceNow instance.

By default ServiceNow sends a URL to https://yourinstance.service-now.com/nav_to.do?uri=incident.do?sys_id=cac2a0e67c9095c0635d3aee628a5942

This will result in the behavior that the user will be directed to the ServiceNow instance and not the portal.

The (almost perfect) solution

Continue reading…»

Cool Twitter feed on your ServiceNow homepage

General 1 Comment »
by:

In this blog I will show you how to create a cool Twitter widget for on your ServiceNow homepage.
I want the Twitter widget to save all the tweets into a custom table. This because the Twitter RSS feed API will only return the tweets from a few days in the past.
Also the Twitter widget needs to be maintainable from a preferences screen, therefore I will create some preferences in the System Properties (sys_properties)
The user must be able to fill in an search query for the tweets, the maximum results that must be showed in the widget and the maximum age of a tweet.
I will use the Google API to read out the RSS from Twitter.

We will walk through the following steps for this cool widget:

  • Create a custom table
  • Create the form and table fields
  • Create the System preference variables
  • Create a System property category for our preferences screen
  • Create a Script Include that can parse XML records for our UI Page
  • Create UI Script to load the Google API
  • Create UI Page to build our HTML with the Twitter feeds
  • Make a new widget for showing our Twitter Widget
  • Place the widget on the homepage

Create custom table


Create a table with the label “Twitter Widget”, check “Create new application” with name “Twitter Widget” and create a new module in the new application, see picture above.

Navigate to the new created application, open the form view and edit the Form layout.
Continue reading…»

Prefill form without insert, URL encode and optional use Tiny URL

General No Comments »
by:

Sometimes you don’t want to create a record but you need to prefill some fields on the form.
You can do this by creating a “dynamic” URL, like this for example in an UI Action (Button) to copy a change task:

[cc lang=”javascript”]
var link = ‘/change_task.do?sys_id=-1&sysparm_query=cmdb_ci=’ + current.cmdb_ci;
link += ‘^priority=’ + current.priority;
link += ‘^change_request=’ + current.change_request;
link += ‘^company=’ + current.company;
link += ‘^risk=’ + current.risk;
link += ‘^impact=’ + current.impact;
link += ‘^urgency=’ + current.urgency;
link += ‘^assignment_group=’ + current.assignment_group;
link += ‘^short_description=’ + escape(current.short_description);
link += ‘^description=’ + escape(current.description);

gs.addInfoMessage(“New change task created as a copy of change task ” + current.number);
action.setRedirectURL(link);
action.setReturnURL(current);
[/cc]

In the script above we will create a link where we redirect the user to.

We use the Javascript function “escape” to encode the value for use in a URL, this prevents errors in the URL with the use of &, ?, ‘ and = signs
(I first used Packages.java.net.URLEncoder.encode but when it’s not needed don’t use Packages)

Optional we can enable the Tiny URL plugin http://wiki.servicenow.com/index.php?title=Tiny_URL_Support.
This will keep the URL tiny and the URL can be as large as we want. When the plugin is enabled the URL will become:
[cc lang=”text” nowrap=”0″]
https://demo12.service-now.com/change_task.do?sysparm_tiny=2518b1eb745320004108ff966b883c29
[/cc]
instead of:
[cc lang=”text” nowrap=”0″]
https://demo12.service-now.com/change_task.dosys_id=-1&sysparm_query=cmdb_ci=a9c0c8d2c6112276018f7705562f9cb0^priority=3^
change_request=undefined^company=^risk=2^impact=3^urgency=3^assignment_group=^short_description=Rollback
%20Oracle%20Version^description=Performance%20of%20the%20Siebel%20SFA%20software%20has%20been%20severely
%20degraded%20since%20the%20upgrade%20performed%20this%20weekend.%20%0D%0AWe%20moved%20to%20an%20unsupported
%20Oracle%20DB%20version.%20%20%20Need%20to%20rollback%20the%20Oracle%20Instance%20to%20a%20supported%20version.
[/cc]

When we look in the Tiny URL table (sys_tiny_url) we will find our record with the following data:
[cc lang=”text” nowrap=”0″]
sys_id=-1&sysparm_query=cmdb_ci%3Da9c0c8d2c6112276018f7705562f9cb0%5Epriority%3D3%5Echange_request%3D
undefined%5Ecompany%3D%5Erisk%3D2%5Eimpact%3D3%5Eurgency%3D3%5Eassignment_group%3D%5Eshort_description%3D
Rollback+Oracle+Version%5Edescription%3DPerformance+of+the+Siebel+SFA+software+has+been+severely+degraded
+since+the+upgrade+performed+this+weekend.+%0D%0AWe+moved+to+an+unsupported+Oracle+DB+version.+++Need+to
+rollback+the+Oracle+Instance+to+a+supported+version.
[/cc]
The Tiny URL will be used when the length of the property glide.tiny_url_min_length is exceeded. (default 1024)

If you have any questions you can contact me using mail on menno.aret@2e2.nl.

Client Script for multiple fields

General 5 Comments »
by:


Imagine you have a form – say for example the incident form.

And the impact is depended on the selected values from the “Urgency” and the “Category” field.
For example we define these rules for the fields on the form

Urgency Category Impact
1-High Database 1-High
2-Medium Software 2-Medium
3-Low Hardware 3-Low
3-Low

Continue reading…»

Handling variable coalesce in transform maps

General No Comments »
by:

Sometimes a functional request might look difficult, but after taking a closer look the solution can be easy….

When creating a transform map for importing records in a target table, you can set the coalesce on one or more field maps. This way you can find the corresponding target record.

The wiki of Service-now.com describes this on http://wiki.service-now.com/index.php?title=Creating_New_Transform_Maps#Creating_a_Field_Map

Our customer asked us to create a Transform Map where the unique key is not always on the same field maps. So for example if you are creating a transform map for importing users into the sys_user table, you must be able to define the correct user record on the AD account ór employee number.

The problem

If you do it the normal way, you would set the coalesce on 2 field maps (AD account and employee number) however, when the source record has an incorrect value for the employee number and a correct value for the AD account, the result will be an “insert action” for this user since the target record isn’t found.

We have found a simple and effective solution.
Continue reading…»