Best Practices - Questionnaires


Multi-section questionnaires

Note: Available from Product name - ev itsm.png version H2.2016 and Product name - ev sas.png version H1.2017

Basic principles

The concept of sections was introduced in questionnaires in order to meet the following needs:

  • Configure the contents of a question based on the answer to a previous question for questions containing SQL code.

    Example documentation icon EN.png The first question asks users to select a group while the second asks them to select an employee belonging to the previously selected group.

  • Facilitate the completion of large questionnaires for users.

    Example documentation icon EN.png A questionnaire with 70 questions spread over three pages.

  • Ensure that users complete the entire questionnaire before submitting it.

    Example documentation icon EN.png A customer satisfaction survey contains 20 optional questions. If these are spread over two pages, this avoids quick answers limited to the first few questions of the survey. 

Open url.png See the description of properties.

Configuring questions whose contents depend on previous questions containing SQL code

To configure this functionality, the answer to the first question must be saved in the database so that its identifier can be retrieved and used in another question.

  • The first question must be displayed in one section and the second in another section.
  • Once the last question in each section is completed, all of the answers in the section will be saved in the database. You can then go on to the next section.
    Note: If the last question in the section is an SQL List question, the system will display the next section automatically. Users do not need to click [ NEXT ].

Limits

  • Only the questions found in the same section will be presented in the display condition of a question. If you want your question to be based on a previous answer in an earlier section, you must use an SQL condition.
  • To configure questions based on previous answers to SQL List questions, you must edit the questionnaire sections in the parent questionnaire. This is the only way in which you can use tags corresponding to answers to previous questions in earlier sections in a multi-section questionnaire.

Procedure

    Download icon.png  Download Example of a multi-section questionnaire

1. Create the different sections you want without configuring the conditions that will be based on previous SQL List questions.

2. Create the multi-section questionnaire and associate the sections you created.

3. Edit the section containing a question whose contents are based on a previous answer. Add the code of the previous question using the Roles-Tags window icon.png icon.
         Question_code tag.png

4. Once you have duplicated existing questionnaires to divide them into sections, check that the display conditions of the original questionnaire do not refer to questions that have been moved to different pages. Open url.png See the query in the FAQ.

Best Practice big icon.pngBest Practice

  • When the last question of a section is an SQL List question, the next section will automatically appear once this question is completed. To remove the need for users to click [ NEXT ] to go on to the next section, you should try to place this type of question at the end of the section.
  • Enter a unique and meaningful code for all multi-section questions that are referenced in the display conditions of other questions because this code will be used as a key in the condition.
  • When the contents of a question depend on the answer to an SQL List question, remember to design your questionnaire so as to take into account situations where there may be no answer given.

    Example documentation icon EN.png List of incidents for a given asset

    Best Practice icon.png Not recommended
    SD_REQUEST.ASSET_ID=cast('#[QUESTION_CODE.ASSET]#' as integer)
    • The cast function replaces null values with a zero, e.g. if no equipment was selected.
    • The query will not return any result.
    SD_REQUEST.ASSET_ID=#[QUESTION_CODE.ASSET]#
    • If no equipment was selected, the query displays an error message when users select an incident.
  • In certain cases, we recommend that you display a question whose contents depend on a previous answer to an SQL List question only if the previous question was completed.

    Example documentation icon EN.png Questions for selecting a department by level

    • The Department level L+1 question should only be displayed if the Department level L question was completed.
    • In this case, as the questions must be placed in different sections, you must use the SQL display condition.
               Open url.png  See Display condition based on a question in a previous section.

Procedure: How to change a large questionnaire to a multi-page questionnaire

ProcedureChangeTypeQuestionnaire

1. Analyze your questionnaire to:

  • Decide how many pages it should be divided into.
  • Determine the questions to be placed at the start and end of each page.

Note: The display condition of a question based on a previous answer in an earlier page must be expressed again as an SQL condition. 

  • To save time and facilitate the expression of these SQL conditions, you should group, on the same page, questions whose answers determine the display of other questions and these conditional questions. 
  • If the questions cannot be grouped, edit the display conditions to change them to SQL.
    Open url.png  See the example of a query.
  • Note down the display order value of the first and last questions of each page. 

2. Duplicate the questionnaire as many times as required to create the pages in your questionnaire:

  • Check the Is a section box. 

3. Edit each of the questionnaire sections you just created and delete the questions now found in the other sections (pages).

Note: In large questionnaires, it may take some time to delete a question. You can delete questions quickly by running a query in the database:

  • Edit each of the questionnaire sections and take note of the identifier displayed in the URL to the right of the q2_id parameter:
             GetQuestionnaireID.PNG
  • Run the following query: Caution: You should test the query first in the sandbox environment because it involves the deletion of data.
    DELETE FROM sd_question_question_list
    WHERE  question_list_id = parameterValue
          AND ( display_order < firstQuestionOrderValue
          OR display_order > lastQuestionOrderValue );

4. Create the multi-section questionnaire and associate the questionnaire sections you previously created by specifying New page for each section.

5. Once you have duplicated existing questionnaires to divide them into sections, check that the display conditions of the original questionnaire do not refer to questions that have been moved to different pages. Open url.png See the query in the FAQ.

6. Replace the large questionnaire in your repository (workflows and questionnaire overrides).

endProcedureChangeTypeQuestionnaire

Display condition based on a question in a previous section

If you are unable to group a question and its corresponding conditional question within a given section, then you must use the SQL display condition.

Example documentation icon EN.png  For a checkbox condition:

Table

SD_REQUEST

Joins

INNER JOIN SD_QUESTION_RESULT ON SD_QUESTION_RESULT.REQUEST_ID = SD_REQUEST.REQUEST_ID
INNER JOIN SD_QUESTION ON SD_QUESTION_RESULT.QUESTION_ID=SD_QUESTION.QUESTION_ID AND SD_QUESTION.QUESTION_CODE='questionCode' AND SD_QUESTION_RESULT.RESULT_BIT = 1

Condition (WHERE)

SD_REQUEST.REQUEST_ID=@ID@

To take into account multi-cart cases, you should add a second condition using the OR operator and replace the previous joins with the ones below:

INNER JOIN SD_REQUEST_DETAIL ON SD_REQUEST_DETAIL.REQUEST_ID = SD_REQUEST.REQUEST_ID
INNER JOIN SD_QUESTION_RESULT_DETAIL ON SD_QUESTION_RESULT_DETAIL.REQUEST_DETAIL_ID=SD_REQUEST_DETAIL.REQUEST_DETAIL_ID
INNER JOIN SD_QUESTION QUEST_DETAIL ON
SD_QUESTION_RESULT_DETAIL.QUESTION_ID=QUEST_DETAIL.QUESTION_ID AND QUEST_DETAIL.QUESTION_CODE='questionCode' AND SD_QUESTION_RESULT_DETAIL.RESULT_BIT = 1

Limits

  • SQL List questions based on answers to previous questions (using a #QUESTION_CODE.xxx# tag) cannot be tested in preview mode. An error will appear if you try to open the list.
  • The override functionality in questionnaires will no longer be available for sections.
  • The space for displaying text is reduced in sections/pages.
    • When you divide a questionnaire into sections/pages, you should shorten long text to avoid displaying it over several rows.
    • To increase the space available for displaying text, you can add the following override to the customer_optimized.css file:
.question_label {    white-space: nowrap;  }

Survey questions

Note: Available from Product name - ev itsm.png version H2.2016 and Product name - ev sas.png version H1.2017

You define the display of survey questions by adding a table header question followed by a series of radio button questions with the same choice of answers. No labels should be displayed (Display item label = False).

    Download icon.png Download Export example of a survey questionnaire

  • To ensure that radio buttons are correctly aligned, you should specify the same number of options in each row (up to 11) for each question in the series. You should also define the same alignment, i.e. left, center or right.
  • The space reserved for displaying the radio button answers is divided into 12 columns.
    • Depending on the number of answers to a question, each radio button will be displayed in a space whose width will vary from one to six columns.
    • If your question has seven answers, the seven radio buttons will be displayed in the same way as a question with 11 options. This means that there will be one radio button in each column.
Number of options Number of columns for displaying a radio button
2 6
3 4
4 3
5,6 2
7 to 11 1
  • To align radio buttons for two series of questions with different numbers of options, you can proceed as follows for the series with fewer options:
    • Add empty elements in the table header so as to have the same number of elements as the other series of questions.
    • Specify the same value in the Number of Elements in a Row parameter as in the other series of questions.

Best Practice icon.png 

  • Select the Center alignment for the text in the table header and for the radio buttons.
  • If the text in the table header is too long, insert a line break by adding the <BR /> tag to prevent truncation.
             Rating EN-une ligne.PNG
             Rating EN-2 lignes.PNG

Configuring target fields

From the 2015 version of Product name - ev itsm.png onwards, you can configure questions within a questionnaire so that their answers are saved in the SD_REQUEST table fields.
Target fields are especially useful for portal apps in which users can create an incident or service request. This functionality enables you to specify the equipment, location and other fields.

Question specific to Product name - ev sas.png

  • Configure the questionnaire so that questions with target fields are displayed only when the incident/request is created in Product name - ev sas.png, by selecting the Apps Only option.
  • Caution: If you use the SD_CATALOG_ID field (catalog category) as the target field, the value will not be recalculated by the system (target resolution date, SLA, workflow, etc.).

Best Practice icon.png  You should pay special attention to mandatory fields in the quick call, such as location or urgency. If you add them to the questionnaire, you should ensure that the questions are defined as mandatory. If this is not the case, then default values will be deleted in the database, thus preventing the workflow from starting correctly.

 

Ensure consistency with other updated sources of data

  • Identify business rules and internal update steps that can modify destination fields used in questionnaires.
  • Check for global consistency.
     

Check that target fields are not updated by theme wizards

  • System fields such as RFC_NUMBER or REQUEST_ID are protected and cannot be specified as the target.
  • Certain fields are updated in a specific context.

    Example documentation icon EN.png  The REQUESTOR_PHONE field is found in the transfer wizard for change requests. However, it can also be used as the target in an incident process questionnaire.

List of fields to avoid as targets depending on context (except for Apps Only questions)

  • Incident:
    • EXPECTED_START_DATE_UT
    • EXPECTED_END_DATE_UT
    • DESCRIPTION
  • Change request:
    • REQUESTOR_PHONE
  • Multi-cart change request:
    • CI_ID

Formatting questions

Questions containing HTML code

From Product name - ev itsm.png version H1.2016 onwards, you can define the layout using the WYSIWYG editor available for the Description field in questions.

You should limit complex formatting (e.g. tables, images, etc.) to Comment type questions.

Comment questions

You can ask users to add details, recommendations and comments using Comment questions. No data entry field is added. 

Note: These questions will be displayed over the entire width of the questionnaire.

Known errors

Context Description of the error Workaround solution
The last question in the questionnaire is an SQL List question The questionnaire will automatically be submitted after the last question is completed. If the last question in your questionnaire is an SQL List question, you can add an empty row or a horizontal line below the question to avoid this issue.
Dynamic values wrongly included in the list of previous questions In a multi-section questionnaire, the list of tags for questions from previous sections displays dynamic values even though it is not supposed to do. This will be corrected in the next version.

In the meantime, you should avoid using tags that represent dynamic values in your queries (e.g. #[QUESTION_CODE.@now]#, etc.).

Mandatory questions and labels containing <div> tags The asterisk in mandatory questions is displayed above the label if the label contains HTML code with the <div> tag. Add the following override to the customer_optimized.css file:
.question_label label {
    display: inline-flex;
}

FAQ

From version H2.2016 onwards, labels in questions are aligned by default to the right. If you want to align them to the left, you should add the following override to the customer_optimized.css file:

.question_label {    text-align: left; }

After splitting the questionnaire, display conditions based on questions that have been moved to another section must again be configured as an SQL condition. Open url.png See this section.

Run the query below to identify the questions whose display conditions must be reconfigured:

SELECT q.question_id as 'Referenced Question (ID)',q.question_en 'Referenced Question',questCondition.QUESTION_LIST_ID 'Questionnaire (ID)',
qlist.QUESTION_LIST_EN 'Questionnaire',questCondition.QUESTION_ID 'Question with condition to be reconfigured (ID)' ,
qConditionned.QUESTION_EN 'Question with condition to be reconfigured'
FROM sd_question q
INNER JOIN ( SELECT T.C.value('.','nvarchar(max)') as guid,A.*
FROM
(
SELECT T.C.query('.') as XML,A.*
FROM (SELECT QUESTION_ID,QUESTION_LIST_ID,DISPLAY_ORDER,cast(CONDITION as xml) CONDITIONs FROM SD_QUESTION_QUESTION_LIST
) A
CROSS APPLY CONDITIONs.nodes('/conditions/condition') T(C)
) A
CROSS APPLY XML.nodes('/condition/guid') T(C) )  questCondition on questCondition.GUID=q.QUESTION_GUID
INNER JOIN SD_QUESTION_LIST qlist on qlist.QUESTION_LIST_ID=questCondition.QUESTION_LIST_ID
INNER JOIN SD_QUESTION qConditionned on qConditionned.QUESTION_ID=questCondition.QUESTION_ID
WHERE NOT EXISTS (SELECT 1 FROM SD_QUESTION_QUESTION_LIST qql where qql.QUESTION_LIST_ID=questCondition.QUESTION_LIST_ID AND qql.QUESTION_ID=q.QUESTION_ID)

Tags:
Last modified by Unknown User on 2017/04/03 09:33
Created by Administrator XWiki on 2015/04/15 17:13

Shortcuts

Recent Updates

Haven't been here in a while? Here's what changed recently:

-   Product name - ev itsm.png
-   Product name - ev sas.png

Interesting Content

How to Automate Integration
Add a Shortcut to an App
History
Quick Dashboard
Full text search - Stop Words

Powered by XWiki ©, EasyVista 2018