Learning ServiceNow
上QQ阅读APP看书,第一时间看更新

Adding a field

Now that we've got a table, let's go ahead and add some additional fields to our virtual war room table, within this list of table columns (which is actually a list formatter within a form). To do that, we have two options:

Since List edit insert row (a property of this list formatter) is enabled, option 1 is that we can actually scroll to the bottom of the list and double-click in the bottom row, where it says Insert a new row..., and it'll let us insert a new table column record just by specifying a few values here:

Any values we leave out will just be set to their default values, or blank. The only down-side to this, is that it doesn't allow you to see and edit all of the fields that might be relevant when creating a new table column; only those which are shown in this list formatter.

However, we've also got option two: Simply clicking the New button at the top-left of the list formatter. This will take us to the new record form for this particular table (which happens to be the Dictionary table, as all table and column definitions are stored there). This form has built-in logic to (for the most part) show us only fields which are relevant to what we're trying to create.

For our first custom field, let's create one to hold a reference to a particular incident ticket, since major incidents are the sorts of tickets that we want to result in war rooms being created for triage and remediation:

  1. If you haven't already, click on the blue New button at the top-left of the table columns list, on the Virtual War Room table definition form.
  2. Click on the magnifying glass on the right side of the Type field.
  3. At the top-left of the Field Classes list window (next to the filter icon), click on the magnifying glass again. Then, under the Label header, enter Reference and press Enter. The breadcrumb text next to the filter icon will update, and you should see one field type matching your query, called Reference.
  4. Click on Reference in the field classes list window, and the Type field will be populated. In that field, you'll see the word Reference. You'll also notice that several new fields have appeared, based on your selection.

Interestingly, the Type field is, itself, a reference field!

  1. In the Column label field, enter Major incident. The column name should then auto-populate, and contain u_major_incident.
  2. The Max length field can remain blank, as it will automatically be set to its default value for the reference field type (32 characters) after we save. However, we do want to ensure that virtual war rooms are not created or worked on without being associated to a major incident; so over on the right side of the form, tick the box marked Mandatory.
  3. In the Reference Specification form tab/section, there's a field called Reference. This is where you should enter the table in which the records you're referencing can be found. Since we're dealing with Major incidents in our virtual war room application, let's have this field reference the Incident table.
  4. Rather than clicking the magnifying glass this time, try just typing incident into the field. You'll notice a drop-down list appears after a brief moment. You must select the one from that drop-down that is just Incident. It'll have the label (Incident) on the left, and the table name (incident) on the right, but it won't be called incident_task or anything else:

.

If the Reference field turns green, it means you didn't select a reference table from the drop-down, and ServiceNow will attempt to create a whole new table for you to reference. This is definitely not what we're looking for. If that happens, re-type incident in the Reference field, and make sure to select one of the options that appears later in the form.

Remember when we clicked on the magnifying glass to the right of the Type field? The window that popped up showed us records from a specific table. This is the table specified in the Reference field in that particular field's dictionary.

  1. Right-click on the header of the Dictionary Entry form, and click Save. This will submit the record to the database, without returning you to the previous page, so you can continue to work on the record.

Before I save a record, I usually glance up at the top-right of my screen, to make sure that I'm still in the correct update set. However, if you tend to work in multiple windows or tabs, it's easy to change your update set in one tab, but have it not reflect in the other tabs. Since which update set your work is stored in, is determined server-side, you may need to be proactive about ensuring you're still in the right set. To check if you're really in the update set that shows in your banner frame, click on the System Settings gear menu at the top-right, and go to the Developer tab. Click on the far-right Refresh icon next to the Update Set picker drop-down, and check to make sure that the selected update set doesn't change after 1-5 seconds.

As you may recall, this virtual war room application is really meant for only Major incidents. Each company might have different criteria for exactly what constitutes a major incident, but ITIL implies that generally incidents with the highest priority and the highest impact, are major incidents.

We did make the Major incident field mandatory, but there's nothing currently preventing someone from creating a virtual war room and associating it with a low-priority incident. Luckily, ServiceNow gives us an easy way to filter the types of records that can be selected from a given Reference field, using a Reference qualifier, also known as a Reference qual condition or simply refqual. This is a condition that is applied to the Reference field, so that only records which match that query can be selected.

In order to ensure that only incidents with the highest priority and impact are selectable, we simply add conditions using the condition builder below the Reference field in the Dictionary Entry form. The conditions should look something like this:

Right-click on the header of the content frame, and click Save again. After the frame reloads, it should look something like this:

To return to the table record and column list, you can click the left-facing back arrow at the top-left of the page. In the next section, we'll head over to our application to make sure the new field shows up in the default list view for everyone, as its value is a pretty important bit of information!