Attach a report attachment to a record

General 2 Comments »

It sounds simple to do in ServiceNow, but in fact it is not something that works out of the box. What the customer wanted was to compare imported CIs by a discovery tool with the CIs in ServiceNow using scheduled imports and reports. As a result of the comparison several reports are created. The customer didn’t want to send the report by email but wanted to open a catalog request and attach the reports automatically.

We didn’t want to build advanced functionality to accomplish this so we used out of the box ServiceNow functionality.

The following solution has been configured.

The email table

Whenever a report is being emailed an attachment will be stored in the sys_attachment table. This attachment can be used to put in the target record. Since the email should not be send out we’re going to prevent the email from being sent out.


The request is going to inserted by a script whenever a report is being created. This script will also copy the attachment from the email to the target request.

Steps to build

Continue reading…»

Which Assignees have no incidents assigned to them..??!!

General 2 Comments »

“I cannot see which users in my assignment group are not assigned to any incident”.
A valid remark of a customer, which had multiple assignees in multiple assignment groups, and each assignee needed to have three active incidents per assignment group. How can we make this happen?

Database view

First I needed to get the info of the assignment group, the user and the incidents in one view. The most practical way to get this in one overview is by using a database view. In this view we need the assignment group and the users (retrieve this from the sys_user_grmember table) and the incidents (we can use the task table). See below the database view I have created.

As you can see I used a ‘Where clause’ to relate the task ‘Assigned to’ and ‘Assignment group’ from the TASK table to the ‘User’ and ‘Group’ field on the SYS_USER_GRMEMBER table. Be sure to set ‘Left join’ on the TASK table to true.

We will receive a list of all users in all assignment groups that are assigned to a task. We can now see that Fred Luddy is not assigned to any TASK in assignment group ‘RMA Approvers’ (as the number is (empty), but Fred Luddy is assigned to an incident in assignmet group ‘Network’ (we can see an incident number).
Continue reading…»

Same user-ids in LDAP as in ServiceNow: authentication will fail

General No Comments »

Last week my colleague Olivier Cramer wrote an article on how the ServiceNow password generator can make life easier and this week I thought I would add to that same topic a short article.

When you have been using ServiceNow for some time already and there is a need to integrate with an LDAP-based directory service the following situation might occur:

  • You successfully enabled the LDAP/AD integration
  • But you had a (large?) amount of users already created with the same user-id as in LDAP

In this situation the authentication will fail.
But the old password will work.

To get rid of the passwords you cannot leave the password empty for safety reasons.

But the following little script will do the trick! :-))

[cc lang=”javascript”]
var usr = new GlideRecord(“sys_user”);
//Replace user_name to modify filter
usr.addQuery(‘user_name’,’ User.Name’);
while( {
gs.print(“USER X = ” + usr.user_name + “. Password = ” + usr.user_password);
usr.user_password = ”;
gs.print(“USER X = ” + usr.user_name + “. Password = ” + usr.user_password);

Keep in mind that you cannot login without a password.
Now wait for the sync and you are good to go!

Any questions? Send me a mail on