List Collector Population

General 2 Comments »
by:

What to do when you want to populate the left and right side of a list collector variable (slushbucket) with the values found in your database? For example you want to update the member list of a group in a catalog item. The list collector should start with the current situation in your database:

• Left side should contain all users, but not the users who are currently a member of the selected group
• Right side should contain all users who are currently a member of the selected group
Continue reading…»

Querying the BSM map

General No Comments »
by:

An alternative solution for querying the BSM map or other hierarchical data that will improve performance.
Issue:
A Business Service Management (BSM) map graphically displays the configuration items (CI) that support a business service and indicates the status of those configuration items.
Continue reading…»

Merge Duplicates

General No Comments »
by:

Sometime ago I migrated data from one ServiceNow instance to another. Both instances had company and user data, which were not in sync with each other and the new instance ended up with a number of duplicate companies. Manually copying fields and references from one company to another is not very efficient. There has to be an easier way.
This is an example of how you can merge two company records with a UI action together with a GlideDialogWindow and a Script Include. I have made the setup as generic as I possibly could, so that it can be used on other tables without any/much customizations.

Example merge 2 companies

The UI Action calls a UI page and the UI page calls a script include, which is doing most of the work.The following data is copied from the record on which you trigger the UI Action (source) to the record, which you select in the GlideDialogWindow (target):

  • Fields (excluding system fields and empty fields)
  • References to the source record
  • Attachments
  • Field attachments

You can set a parameter to copy source fields to the corresponding target field when the target field is not empty. Default target fields, which are not empty, are not overwritten.
The UI action also does not delete the duplicate record (source), but sets the record to inactive if possible.
Continue reading…»

Importing Attachments from another ServiceNow instance

General No Comments »
by:

A couple of weeks ago I had to migrate data which contained many attachments from one ServiceNow instance to another ServiceNow instance. I found out that it was not as straight forward as I expected it to be. Most of the information is available on the ServiceNow Wiki and ServiceNow community, but it took me some time to gather it all and to transform the information into a working import. I’m sharing my experience here with you and if you know of have a better way to do this, please let me know.

How attachments are stored

First some background information about attachments in ServiceNow. You can find a clear description of how ServiceNow stores attachments in the database in the ServiceNow Wiki article “Administering Attachments”:
When you store an attachment to any table, a record is created in the sys_attachment table that contains attachment metadata, and the file data is stored in the sys_attachment_doc table, in 4k chunks. For example, if you attach a 12k file called My_attachment.pdf, then you would have a sys_attachment entry with 3 related sys_attachment_doc entries.

The relation between the record in any table and its attachment is created with a Document type reference. The two fields table_name and table_sys_id in the attachment table work together to reference the record in any table, for example a company in the company table. See the ServiceNow Wiki article “Creating a Document ID Field” and our SNC-Blog article “Enable use of variables in Change Task” for more information. The relation between the attachment metadata and the file data is created with a standard one-to-many reference.
Continue reading…»

Update Set Deployment Best Practices

General 2 Comments »
by:

October 2013 – Remark: This article has been written in 2011 and is referring to a document listing best practices. This document is not up to date anymore and will no longer be sent out on request.

The deployment of customisations through DTAP (short for Development, Testing, Acceptance and Production) is most of the time a laborious process. Agile software development methodologies have driven radically higher number of release events and software applications are typically in an on-going cycle of development, testing, and release. The complexity grows, when you work with a large development team or even with multiple development teams. This makes the deployment process a delicate one with exceptions and pitfalls.

Service-now.com offers strong support for the deployment of your customizations from a development instance to the production instance. It takes away most of the laborious activities and makes the process easier, but you must not forget to think about what you are doing. Service-now.com uses Update Sets to control the process of making changes to an instance. It is important to be very specific about their use to avoid errors and performance issues. This will involve planning the update process carefully to know what customizations are possible, and knowing what pitfalls to avoid in the process.
Continue reading…»