Dynamic Load Server-side Javascript

General No Comments »
by:

When creating custom solution in ServiceNow it is important to clarify the technical requirements of its functionality. After clarification it is good practice to check if the required functionality already exists in ServiceNow, either an out of the box or a custom created solution.
The needed functionality can reside in script includes or UI scripts.
It is easy to make use of these functions when you create server side script like business rules and access controls. This can be done using js.include(‘My Script.js’); in the beginning of the script, replacing My Script with your own script name.
There is no standard way of loading a server side function from a client side script like UI Actions, UI Policies or Client Scripts.
The following can be done to make this possible:
First create your server side function if it doesn’t already exist. See example in the next screenshot.

The example function “MyFunction” will pop-up a confirmation box with the option to select Ok or Cancel button. Feel free to select or create the function that you need instead of this one. Initialize is a mandatory function and make sure that the name of your UI Script or Script Include is the same name as the variable on the first line. If you are testing in Firebug, then make sure that you refresh the page after you have edited your script otherwise it might not find your function.

More info on this:
http://wiki.servicenow.com/index.php?title=Script_Includes
http://wiki.servicenow.com/index.php?title=UI_Scripts

To call this function you can use the following code:
Continue reading…»

Using the ODBC-plugin with ServiceNow

General No Comments »
by:

One of the remarks heard most often about a SaaS (Software as a Service) solution is the lack of control it gives you over your own data. In truth most of the existing reporting and BI functionality has to be replaced when moving to a new SaaS implementation.

These things changed when ServiceNow made an ODBC-plugin for the ServiceNow environment available. An ODBC plugin allows reporting or BI tools to connect directly to a database allowing for easier searching and selection of data.

During my first ODBC plugin implementation for a medium to large ServiceNow environment I ran into a few unexpected issues and didn’t manage to find a lot of clear information available on the topic of ODBC implementations. I hope that my lessons learned can help you with your implementations.

Getting the ODBC running

The installation guide provided on the ServiceNow wiki (http://wiki.servicenow.com/index.php?title=ODBC_Driver) helps with the installation. Though the lack of an IOS version might bother some (like me) installing & connecting the plugin is a simple matter. For testing & running your initial connection & SQL queries the included “Interactive SQL” program is a good start. Directly calling the ODBC from Excel also works.

Understanding the ODBC

The ODBC plugin for ServiceNow is a query-only interface; this means that no updates, deletes or inserts are possible when using the ODBC.
Using the ODBC requires a user account on the ServiceNow environment with permissions to the soap role and specific roles required for the tables in scope of the ODBC.
When querying through a table columns are identified by their database name. A choice or Reference column has an additional column with the “dv_” prefix added to its name. These dv_ columns contain the display values for these fields.
Continue reading…»

Confusion about email size

General No Comments »
by:

There is a limit to the size of individual emails that the ServiceNow servers allow. This is currently set to 25MB for both inbound and outbound emails via ServiceNow email servers in the datacenters, this is a common and reasonable process and most customers are aware of the process as they have similar limits on their own corporate emails.
What catches out a lot of users is that when they look at the total size of an email in their email client (for example, Outlook) or in the instance, the size says it is under 25MB but will fail to send (or receive) emails and report that the email size is too big.

Common symptoms

  • After several attempts to push emails through to our instance, they were bounced back as being to large even though the size was verified email size was under 25MB.
  • The following error appears when trying to send emails from our instance but the email records shows it is on 20MB. SMTP Postfix server: “552 5.3.4 Error: message file too big “

Explanation

The limit for both inbound and outbound emails is 25MB, in total size. That means that any email needs to be _smaller_ than 25MB (Megabytes) to be allowed to pass through the email servers. All emails that are _sent_ from an instance will be encoded (64bit MIME) which increases the original size to 137% which means that any email that shows in the instance as being less than 18.5MB (25MB : 1.35) will be under the 25MB limit and will be allowed through.

It is worth noting that these figures will only ever be approximate due to the process of encoding files, every file reacts differently to the encoding (although the same file will always encode that same) so if fileA=17MB it may end up being 23MB after it is encoded whereas if fileB=17MB it may end up being 23.1MB after it is encoded.
Continue reading…»