This documentation supports the 21.3 version of Action Request System.

To view an earlier version, select the version from the Product version menu.

Creating a survey questionnaire

An application developer can use the Survey Component field in Developer Studio to create a survey questionnaire to ask questions to users and record their responses. An administrator can then use the questionnaire to conduct any type of survey and to make a decision based on the responses received from the users. The Survey Component field is available for use only in Progressive View.


Example

On the Change Request form in a Progressive Web Application (PWA), you can display the questions that are relevant to the risks involved with the change request. The users can respond to those questions and depending on their answers, you can calculate the risks associated with that change request. You can create a more interactive survey questionnaire and use customized processing in calculating the risk.

The following video (5:33) provides a summary of creating a survey questionnaire in Developer Studio for progressive views:

 https://youtu.be/v0VVhzPHQww



To create a survey questionnaire in PWA, perform the following tasks:

Before you begin

Make sure you have a basic understanding of the following:

Task 1: Add a survey component definition in Developer Studio

Add a survey component definition in Developer Studio, which contains the mappings for the following system forms in Action Request System and a qualification. Based on this qualification, the questions and options are shown in the questionnaire.

FormPurpose
QuestionThe questions data is loaded from this form.
OptionsThe options for the selected questions are loaded from this form.
ResponseThe responses to the questions are stored in this form.

Action Request System contains a system form called Survey Component Definition. An administrator can configure the Question form information, Option form information, and Response form information on this form. To configure all this information, the administrator must create a record on the Survey Component Definition form, from where all the questions, options, and responses are fetched. This record is displayed as a value in a list for the Component Definition property in Developer Studio.

Important

If you add a new entry to a system form, or modify an existing entry, you must re-login to Developer Studio for the changes to take effect.

For example, you can create the following entities:

  • A record called Survey Questionnaire
  • Three custom forms, namely Survey_Question, Survey_Option, and Survey_Response
  • General fields, such as Question ID, Parent Entity IDQuestion Label, Locale, and Company

Important

The Question ID field can be a unique identifier across all the three forms. The Parent Entity ID field is a record ID. The Parent Entity ID can be any custom ID.

To add a survey component definition:

  1. On a form in progressive view, drag the Survey Component field.
  2. On the Properties pane, expand the Display property group.
  3. Click the Component Definition property.
  4. In the Value column, select the record that you have already created.

Task 2: Add a qualification with a qualification field ID

A qualification field ID is an ID on the form where your survey is available. Based on the qualification that you select during runtime, the questions and options for the survey questionnaire are displayed in PWA. You can specify a qualification at runtime or you can hard code it while creating your survey questionnaire.

Important

You must have at least one qualification defined. Without a qualification, your survey is not displayed in PWA.

To add a qualification:

  1. In the Properties pane, click the Qualification Field ID property.
  2. In the Value column, click the ellipsis () button.
  3. In the Qualification Field ID dialog box, select the required field.

  4. Click OK.

Task 3: Add a parent entity ID

The parent entity ID is used for edit and view purpose, to display the records in the View or Edit mode. The Parent Entity ID field holds the value of a record ID. Based on this record ID, the records that are to be displayed on the UI are fetched.

For example, in the View mode, the records are displayed as follows:

In the Edit mode, the records are displayed as follows:

To add a parent entity ID:

  1. In the Properties pane, click the Parent Entity ID property.
  2. In the Value column, click the ellipsis () button.
  3. In the Parent Entity ID dialog box, select a field that is a record ID.

  4. Click OK.

Task 4: Enable displaying a survey in View mode

To show a survey questionnaire in the View mode, set the value for the Display As Text property to True. Only when this property is set to True, the Question Font and Answer Font properties are enabled in Developer Studio.

For example, the following image shows a survey questionnaire in the View mode:

To enable displaying a survey in the View mode:

  1. On the Properties pane, click the Display As Text property.
  2. In the Value column, select True from the list.

Task 5: Set the fonts for questions and answers

  1. In the Properties pane, expand the Font property group.
  2. Click the Question Font property.
  3. In the Value column, select a value from the list.
  4. Click the Answer Font property.
  5. In the Value column, select a font from the list.

Important

When you save the progressive view, you get a warning message to add the public permission to view the form. Add the specific permission.

Task 6: Set the run process to fetch survey data

PERFORM-ACTION-FETCH-SURVEY-DATA run process

To fetch the survey data, use a run process called PERFORM-ACTION-FETCH-SURVEY-DATA on the survey component. Based on the component ID and qualification, this run process fetches the three primary data forms (Questions, Options, and Response) and their details.

Syntax:

PERFORM-ACTION-FETCH-SURVEY-DATA <Survey Component Field ID>

Important

Fetch the field ID from the PWA survey component.

After this run process is complete, the new survey component is loaded on the UI.

MAPGET function

The MAPGET function returns the value of the key mentioned in its arguments. It returns the current response of the Question ID.

Syntax:

MAPGET(<Survey Component Field ID>, <Question ID>)

Important

For the MAPGET function to work, the Question ID must be a single word. It must not contain multiple words with spaces. Also, you must use MAPGET in a different workflow.

Learn more about the MAPGET function at Functions.

Task 7: Map keywords with fields to store survey data

To retrieve and store the information about a question and the corresponding response from a user, you must map the following keywords with the corresponding fields on your form:

KeywordDescription
$SURVEYQUESTION_CURRENTID$Holds the question ID of the last responded question
$SURVEYQUESTION_LASTRESPONSE$Holds the old value of a response in case the user updated the response
$SURVEYQUESTION_CURRENTRESPONSE$Holds the new value of a response in case the user updated the response

If a user selects a new response, the value held by the $SURVEYQUESTION_LASTRESPONSE$ keyword is blank. The value held by the $SURVEYQUESTION_CURRENTRESPONSE$ keyword is the new response that was selected by the user.

If the user updates a response, the $SURVEYQUESTION_LASTRESPONSE$ keyword holds the value of the response that was previously selected by the user. The $SURVEYQUESTION_CURRENTRESPONSE$ keyword holds the value of the new response selected by the user.

To map the keywords with the fields:

  1. Create three fields on your form that can hold the values for the preceding three keywords. For example, Current Question ID, Last Question Response, and Current Question Response.
  2. Create a new active link. Learn how to create an active link at Creating active links.
  3. Create a Set Fields action and add the preceding keywords as values for three fields. For example, $SURVEYQUESTION_CURRENTID$$SURVEYQUESTION_LASTRESPONSE$, and $SURVEYQUESTION_CURRENTRESPONSE$. Learn how to create a Set Fields action at Creating a Set Fields action.

Important

Developer Studio supports the preceding keywords only in progressive views and these are evaluated at the client side. That is, the keywords are evaluated as part of an active link execution.

Task 8: Get the survey status

To get the survey status, you must use the GETSURVEYSTATUS function in Developer Studio. This function returns the status based on whether all questions are answered or not.

Returned valueDescription
0Returns 0 if all questions are not answered
1Returns 1 if all questions are answered

To get the survey status:

  1. Create a field, for example, Survey Status on your form.
  2. Create a Set Fields action and then as a value for this field, select GETSURVEYSTATUS in the Expression Editor. Learn how to create a Set Fields action at Creating a Set Fields action.
  3. In Available Fields, select the field ID.

Important

Developer Studio supports the preceding function only in progressive views and it is evaluated at the client side. That is, the function is evaluated as part of an active link execution.

Learn more about the GETSURVEYSTATUS function at Functions.

Was this page helpful? Yes No Submitting... Thank you

Comments