Copying an object based on a respondent's answers

Create a response action that copies an existing object. The new object, a child of the questionnaire assessment's parent, is created based on the answers that are provided by a respondent.

Before you begin

To begin editing a questionnaire template, you must be on the Editor tab of the Questionnaire Template page. If you are not on the Questionnaire Template page already, do the following steps:

  1. Open the Primary menu and select Assessments > Questionnaire templates.
  2. Click the name of the questionnaire template that you want to edit.
  3. Click the Editor tab.

About this task

In this task, you are configuring a response action that copies an object.

A response action is a set of operations that you define for a questionnaire template. To run response actions, you must configure a Questionnaire response action operation on an action in the Questionnaire Assessment Workflow. When a questionnaire assessment runs the workflow action, it processes all the response actions that are defined for the questionnaire template that is associated to the questionnaire assessment.

Procedure

  1. Click Response actions in the left panel.
  2. Click New response action.
  3. Enter a Name for the action.
  4. Optional: Enter a Description for the action.
  5. Optional: In the Action applicability section, define the conditions that cause the action to occur:
    1. Click Select a question.
      Select a question from the list. You can choose from single or multiple-choice questions in any section or subsection.

      Scroll down and click Select.

    2. Select Answer and choose one or more values for the condition.
      The operator is already set to in. This operator causes the answer to be compared to the list of values you select in Answer. If the answer matches one of the selected values, the condition evaluates to true.
    3. Optional: If you want to apply more conditions, click New condition and repeat steps 5a and 5b.
    4. Optional: Set Advanced logic to On to override the default rule that all conditions must be met.

      To write an expression, use the condition numbers together with the operators AND, OR, NOT, and parentheses. The expression is not case-sensitive. The operators are processed in the following order:

      1. Parentheses
      2. NOT
      3. AND
      4. OR

      The following examples show how to construct an expression.

      • 1 or 2 or 3
      • 1 and (2 or 3)
      • 1 not (2 or 3)
  6. In the Operations section, select Copy object.
  7. In Child object type, select the type of object that you want to copy.
  8. In Object to copy, click Select object.
  9. In the dialog box Copy <object_type>, where <object_type> is the child object type you chose to copy, select the object you want to copy and click Done.
  10. Optional: In Keep relationships, if you want the copy of the object to retain the parent associations that the source object has, select the object types for which you want to retain relationships.
    For example, if you copy a Control and select Requirement, the new object is associated to the same parent Requirement objects as the source Control object.
  11. Optional: If you want to set the values of fields for the new object, click Set field value for each field that you want to set.
    Otherwise, skip the next step.
  12. Specify the values that you want to apply to object fields when the conditions are met:
    1. For Operation type, select Set field, Set field with answer, or Add new values to field.
      • To specify a value for the field in this operation, choose Set field.
      • To set the field in this operation with the answer that the respondent chose for the question, choose Set field with answer. When you choose the Set field with answer operation, you can set simple and long string fields in an object by using the questionnaire answers from short text or long text questions.
      • To add values to the list of values that are already defined for the enumeration string field, choose Add new values to field. The Add new values to field operation doesn't replace the values like the Set field operation does.

        For example, an enumeration string field that is named Categories has the values Color & Shape. If you choose the Set field operation and set Value / Question to Size, the Categories field has a value of Size after the response action runs. However, if you choose Add new values to field, then the Categories field has values of Color, Shape, and Size after the response action runs.

    2. For Field name, select the field you want to set.
    3. For Value / Question, do one of the following steps:
      • If you selected Set field as the operation type, enter or select the value that you want to set the field to.

        You can enter an expression for the value. For example, you can enter [$TODAY$] for the current date,[$END_USER$] for the name of the signed on user, or [$System Fields:Description$] to set the field to the value of the Description field of the object. This expression implies that the Description field comes from the active object, or self, rather than a child or parent of the active object.

        If you are setting a field on an existing object, and you are using an expression for the value of a field, self refers to the questionnaire assessment.

        If you are creating a new object, or copying an existing object, and you are using an expression for the value of a field, self refers to the parent of the questionnaire assessment.

        For more information about using expressions, see Syntax rules for expressions and Using variables, functions, and fields.

      • If you selected Set field with answer as the operation type, select the question that has the answer you want to use to set the field.
      • If you selected Add new values to field as the operation type, select the values that you want to add to the enumerated string field.
    4. Optional: If you want to set another field value, click Set field value and repeat the steps to specify a field value.
  13. Optional: To copy a child object related to the object copied earlier, do the following:
    1. Click Copy related child.
    2. Optional: If you want to set the values of fields for the new object, click Set field value for each field that you want to set.
      Otherwise, skip the next step.
    3. Follow the instructions in step 12.
    4. If you want to add more related children, repeat steps a-c.
      Note: Only one extra layer of related child objects from the initially copied object is supported (that is, no nested related-child of related-child copies).
  14. Review the response action and edit it as necessary. When you finish reviewing, click Save.

What to do next

To run the response action, add an operation on an action in the Questionnaire Assessment Workflow. For more information, see Running an action based on answers in a questionnaire assessment.