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

Extending the task table

The task table is an incredibly powerful base table, yet interestingly, no records should ever be created directly on the task table. Instead, task records are created on child tables; tables that extend the task table. In fact, if you attempt to create a new task directly from the task table, you'll find that you're redirected to the task interceptor instead, which disambiguates which sort of task you'd like to create:

To extend the task table and inherit any relevant fields and business logic, start by navigating to System Definition | Tables. On the list of tables, click New from the top-left.

Since we've already created the Virtual War Rooms table, let's create a sub-table that also extends the task table. We'll call it War Room Task, so enter that into the Label field of the New table form, then press Tab. The Name field will auto-populate with an appropriate name: u_war_room_task.

In the Add module to menu field, select the Virtual War Room application menu we created earlier, and then click the magnifying glass icon next to the Extends table field input box. Search for the text task, and make sure to select the correct Task [task] table as shown in the following screenshot:

Right-click on the New Table form header, and click Save. This will display the table columns that were inherited from the system, and from the task table.

Next, head over to the Controls form section, and check the boxes for Live feed and Auto-number. This will allow users to see a live feed of the activity in the war room task table, and automatically generate the next war room task number for each new war room task.

Once you've checked the Auto-number checkbox, several new fields will show up. In the Prefix field, you might notice that WAR is populated there by default. This means that every war room task number will begin with WAR followed by 7 numbers. Since this is the same prefix we chose for our virtual war room records, let's choose something different. I went with WRT, but you could just as easily use four letters or even more.

Finally, replace the value from the User role field, with itil. This way, any itil user can access the war room tasks table. When you're finished, right-click the header, and click Save again. Congratulations, you've just created a table that extends the task table. This means that our new table will have fields like Active and Assigned to, as well as business logic, such as automatically deactivating after they've been closed.

Tasks are not meant to sit and be stagnant; they are meant to progress through a lifecycle. That lifecycle may include assignment, approval, and manual work; or it may be completely automated!