Generate an Action Response
Questionnaires
Generate an Action Response
Technologies > Software Engineering Techniques > Advanced Techniques > Generate a Questionnaire Action Response
In some cases, you may wish to have an action item(s) generated in response to a questionnaire. To set up an action response, first create a question, filling in the
question.action_response
field with the appropriate 'correct' answer:
The following example view is set up to generate action items when the user clicks on the "Approve" button, provided the answer to the questionnaire question(s) matched the action_response field for that question(s). To generate action items in response to the project approval, the JavaScript calls
generateActions()
:
exPrgQuestionnaireActionResponse_report_onApprove : function() {
this.quest.generateActions([
['activity_log.project_id', this.project_id],
['activity_log.created_by', Ab.view.View.user.employee.id],
['activity_log.requestor', Ab.view.View.user.employee.id],
['activity_log.description', getMessage('actionDescription')]
]);
...
The optional parameter to
generateActions()
is a two-dimensional array containing additional
activity_log
field names and values to be assigned to the new action item. This array can contain any number of fields in the
activity_log
table, excluding those listed in the table below. In the example above, if
this.project
id is 'BUILD-HQ-NEW',
any action items generated
will be assigned an
activity_log.project_id
value of 'BUILD-HQ-NEW'. The example also assigns the user employee id to the
activity_log.created_by
and
requestor
fields.
The following action item field values are pre-determined by the question record:
Field |
Value |
---|---|
activity_log.action_title |
questions.quest_name |
activity_log.activity_type |
questions.activity_type |