Skip to main content

2.2 Add fields

Overview

Earlier, you created the back-end form the fulfiller users will see for records on the Telework Case table. In this exercise, you will create the front-end form with questions for the user to answer when submitting the form.

The fulfiller users have requested that the Record Producer ask the requester the following questions from the PDF form we are digitizing:

  • Who is the request for?
    • Should auto-populate with the name of the current user, but can be edited to a different user.
  • When do you need this?
    • Options should be:
      • Today
      • Tomorrow
      • This week
      • Next Week
  • What type of Telework are you applying for?
    • Options should be:
      • Regular and Recurring Telework
      • Remote Telework
      • Situational Telework
  • Number of Days per Week?
    • Input should only be an integer. No letters allowed.
    • This field should only appear if the answer to the previous question is 'Situational Telework'.
  • What is the reason for Teleworking?
    • Options should be:
      • Dependent Care
      • Medical
      • Reasonable Accommodation

Instructions

info

A Question set is a ServiceNow term for a set of questions that can be re-used across multiple Record Producers and Catalog Items. Some questions in the set might have special logic to validate input or auto-populate answers.

The first two questions you will add to your Record Producer already exist on the system as part of a Question set called 'Standard Employee Questions'.

  • Who is the request for?
  • When do you need this?
  1. Add the 'Standard Employee Questions' Question set.
    1. Click the arrow next to Insert new question.
    2. Click 'Question set'.
    3. Type Standard.
    4. Click on 'Standard Employee Questions'.
    5. Click the arrow to the left of 'Standard Employee Questions' to expand the Question set and see what questions it contains.
note

Advanced ServiceNow users may know Questions sets outside of App Engine Studio by a different name 'Variable sets'.

Questions remaining to add:

  • Who is the request for?
  • When do you need this?
  • What type of Telework are you applying for?
  • Number of Days per Week?
  • What is the reason for Teleworking?
  1. Add the question 'What type of Telework are you applying for?'

    1. Click Insert new question.

    2. Configure the following values:
    Field NameField Value
    Question type:Choice
    Question subtype:Record reference

    1. Scroll down to the Details section.
    2. Configure the following values: (💡 double-click, copy & paste into the form).
    Field NameField Value
    Map to a specific fieldChecked
    Table fieldchoose Arrangement
    Question labelWhat type of Telework arrangement are you applying for?
    MandatoryChecked
    Question PreviewNotice on the right panel, then Question Preview shows what the question will look like to the user.
    info

    Notice the Question Preview that shows what the question will look like to the user.

    1. Click Continue to Additional details.

    2. Type Arrangement the Source table box and click 'Arrangement' in the drop-down.

    3. Click on the Annotation tab.

    In the current process with the PDF, the team is spending a lot of time correcting and manually re-routing Telework requests due to people confusing the different types of Telework arrangement.

    Add an annotation to help the users understand what they are selecting.

    1. Check the box Show instructions.

    2. Open the file: telework_form_annotation.docx.

    3. Copy all the text in the file ( ⌘ Cmd or CTRL+A, CTRL+C )

    4. Paste it into the Instructions box (⌘ Cmd or CTRL+V ). You can choose to either keep or remove formatting.

    5. Click Insert Question.

Questions remaining to add:

  • Who is the request for?
  • When do you need this?
  • What type of Telework are you applying for?
  • Number of Days per Week?
  • What is the reason for Teleworking?
  1. Add the question 'Number of Days per Week?' using a different way.

    1. Click + Insert below the last question you added.
    2. Click the 'New question' tile.
    3. Set the following values in the Type section:

    Field NameField Value
    Question typeText
    Question subtypeSingle line

    1. Scroll down to the Details section.

    2. In the Details section, enter the following information: (💡 double-click, copy & paste into the form).

    Field NameField Value
    Map to a specific fieldChecked
    Table fieldDays per week
    Question labelNumber of Days per Week?
    Namedays_per_week
    1. Click on Additional details.
    2. Click on the Text validation drop-down and select Number.
    3. Click Insert Question.

The Telework Case fulfillers want 'Number of days per week' to only appear if the user answers 'Situational Telework'...

This can be done with a Behavior.

note

Advanced ServiceNow users may know Behaviors outside of App Engine Studio by a different name 'UI Policies'.

  1. Define a behavior for "Number of Days per Week?".

    1. Hover over the question 'Number of Days per Week?'.

    2. On the right side of the row, click this button.

    3. Click Define new behavior

    4. In the Actions tab, we'll specify the behavior we need:

    Field NameField Value
    Make the question mandatoryYes
    Make the question visibleYes

    1. Click on the Conditions tab.

    1. Set the Dynamic Behavior Condition filter to
    arrangementisSituational Telework

    7. Click Add behavior.

info

This will create a UI effect where the "Number of Days per Week" field will only appear when the answer to "What type of Telework arrangement are you apply for?" is "Situational Telework".

Questions remaining to add:

  • Who is the request for?
  • When do you need this?
  • What type of Telework are you applying for?
  • Number of Days per Week?
  • What is the reason for Teleworking?
  1. Add the final question: What is the reason for Teleworking?

    1. Click Insert New Question.
    2. In the Type section set the following values:
    Field NameField Value
    Question typeChoice
    Question subtype:Record reference

    1. Scroll down to the Details section.

    2. In the Details section, enter the following information: (💡 Copy & paste into the form).

    Field NameField Value
    Map to a specific fieldChecked
    Table fieldJustification
    Question labelWhat is the reason for Teleworking?
    Namejustification
    MandatoryChecked
    1. Click Continue to Additional details.

    2. Type just the Source table box and click 'Justification' in the drop-down.

    3. Click Insert Question.

Your screen should now look like this:

  1. Click Save.

Exercise Recap

The Record Producer form now has the required fields and behavior added to it. You were able to leverage a 'Question set' so that you did not have to recreate the Standard Employee Questions.