Transform a field

Transforming a field involves creating a transform record, selecting the transform type, and testing the transform, and running a data job.

Create a transformation record

Creating a transformation record is the first step in transforming a field.

  1. Activate the Field Normalization plugin.
  2. Navigate to Field Normalization > Configurations > Transformations.
  3. Click New.
  4. Create a transformation record.
    Field Description
    Name Unique name for this transformation record. This value is for reference only and is not used in any processing.
    Table Select the ServiceNow table containing the field being transformed. It is important to understand the table hierarchy when setting up a field transform. For example, if you configure transformation for a field in the Computer [cmdb_ci_computer] table, that field will be transformed for all workstation machines, Windows servers, Linux servers, and UNIX servers.
    Field Select the field to transform. The list presented contains only those field types (integer and string) from the table selected that can be transformed.
    Mode The three available modes are Off, Test, and Active. All transformation records are created in the test mode by default. Do not change the mode until you have thoroughly tested the transformation. When testing is complete, change the mode to Active. To disable this transformation, switch the mode to Off.
    Normalize query Select this check box to apply the field value transformed by this record to all queries involving this field. Queries issued with the raw (original) field value will be edited to use the transformation value.
    Raw field Select the field to use to display the original input (non-normalized) values on a form in which a field value has been normalized. For the selection to appear in the drop-down list, add a custom field to the form for the table selected. For instructions on adding a field for raw data, see Create a raw field.
  5. Click Submit.

    The Transforms and Data Jobs Related Lists appear on the form.

Select a transform type

Selecting a transform type is the second step in transforming a field.

  1. In the Transformation record, select the Transforms Related List.
  2. Click New.

    A selection list of transform types appears, displaying only those transformations appropriate for the field type selected.

    Figure 1. Transform types
    Transform types
  3. Select a transform type and provide the appropriate parameters.
  4. Select an Order number for this transform.
    Note: The conditions for the transforms are executed according to the order numbers assigned.
  5. Select the Final check box to stop processing with this transform if the condition evaluates to true.
  6. Select the Case sensitive check box to force case sensitivity in the condition statement.
  7. To create a condition that uses regular expressions or pattern matching, select the correct operator.
    OptionDescription
    regular expressions matches regex
    pattern matching matches pattern

    The following transform example replaces the INC at the beginning of an incident number with the string ENG if the assignment group is ITSM Engineering.

    Figure 2. Transformation record
  8. Click Submit.

    The new Transform appears in the Related List of the Transformation record.

    Figure 3. Transformation record Related List
    Transformation record Related List

    When the Transform is created, a Transformation application data job is also created. This data job applies this transform to appropriate records in the entire database and should not be run until testing is complete.

    Figure 4. Transformation application data job
    Transformation application data job

Test a transform

Testing a transform is the third step in transforming a field.

About this task

Note: Users must have the normalization_tester role to create test records.

New transformation records open in the Test mode by default, enabling administrators to test transforms thoroughly before applying them to the existing records in the database. In the test mode, the Start controls are not available for the Transform application data job. There are two methods, listed below, for testing transforms before committing the transformations to existing data.

Procedure

  • Create or update records.

    In the test mode, only records that have been created or updated by a user with the normalization_tester role are transformed. Grant the normalizer and normalization_tester roles to the same user or grant them to separate users.

  • Test transforms utility.

    This feature enables a normalization tester to transform field values on the fly without opening or updating records. This utility tests all the transforms configured for this field.

    1. Open a Transformation record.
    2. Click the Test transforms Related Link.
      Test transforms Related Link

      A dialog box appears for testing field values.

    3. Enter a value to transform in the Raw data field.
      Raw data field
    4. Click OK.

      The platform transforms the raw value in the Transformed data field.

      Transformed data field
    5. Enter new raw data to test other transforms.
    6. Click Cancel to end the test.
    7. When testing is complete, change the Mode to Active and run the data job.

Run a single data job

Running the data job/jobs is the fourth step in transforming a field. This topic explains how to run a single data job.

  1. Start the Transform application data job to apply the transform to all the appropriate records in the database.
  2. Open the Transformation record and switch the Mode to Active.
  3. Select the Data Jobs Related List.
  4. Run the data job using one of the following methods.
    • In the list of data jobs, select the check box of the job you want to run, and then select Start from the Actions menu.

    • Click the link in the Created column to open the data job, and then click the Start Related Link.

    The State of the jobs turns to Queued as it runs and to Completed when it finishes successfully.

Run multiple data jobs

Running the data job/jobs is the fourth step in transforming a field. This topic explains how to run data jobs for multiple field transformations.

  1. Start the Transform application data job to apply the transform to all the appropriate records in the database.
  2. Navigate to Field Normalization > Data Jobs > All.
  3. Select the check boxes for the jobs you want to start.
    Note: These jobs must have the Mode set to Active.
  4. Select Start from the Actions menu.
    Note: The platform only runs data jobs from Active transformations. The Action menu indicates the number of Active data jobs that can run. For example, the menu might display Start (3 of 4).