Skip to main content

Submit Form-1.0.0

Send a Form to a Channel
key: PBSendSurvey

Overview

This parameterized bot automatically fills out forms and sends them to the channel of your preference.

Take note

This bot is not retro-compatible. Use the latest version for best results.

Special Inputs

Description of special parameters and formats for configuring the bot.

Required ObjectIds

Either of the following fields is required:

  • Survey ID field – surveyId: MongooseObjectId;

OR

note

Obtain ObjectIds from COTSurvey data model.


Either of the following fields is required:

OR

note

Obtain ObjectIds from COTChannel, COTTask, and COTTaskGroup, respectively.


Prefilled Format

The Prefilled field has a custom format, depending on the survey. The general format is { identifier-1: value-1, identifier-2: value-2 ... } .

For example, if a survey has two fields, a text-input ("name") and a number-input ("age"), the correct format would be:

prefilled: {
"name": "Trinidad",
"age": 1
}

Data Types per Question Type

Data types for prefilled surveys depend on the question type or survey component.

Survey Question TypeData Type
Text:(label) cannot be set
Listquestion:string[ ] (array of ON codes) e.g., [ "chile", "usa" ]
Textinput:string
Textnumber:number
Datetime:Date (Not yet implemented)
Property:string[ ] (array of codes) or ObejctId<COTProperty>[ ]
Person:string[ ] (array of emails) or ObejctId<COTUser>[] (NYI)
Calendar:Not yet implemented
GPS:Not yet implemented
Image:Not yet implemented
Signature:Not yet implemented
File:Not yet implemented
Api:Not yet implemented
SurveySurvey:Prefill[ ] // surveys-surveys are defined as as an array of objects. See example.

Survey-Survey Example

If the same survey "name" and "age" is used as a survey-survey, with the identifier user_records, this would create 3 survey-surveys, the first empty, the second with only the name, and the third with both name and age. |

{
"user_records":
[
{ },
{
"name": "Freddy"
},
{
"name": "Kurt",
"age": 27
}
]
}
note

For more information on question types see:


Inputs

1. Form (key: survey)

Code of the Form to be sent
Required: true
Data Type: string

2. Channel (key: channel)

Id of the Channel where the Form will be sent
Required: true
Data Type: CotChannelId

3. Sent by (key: sender)

Id of the User submitting the Form
Required: no
Data Type: CotUserId

4. Received by (key: recipient)

Id of the User who receives the Form
Required: true
Data Type: CotUserId

5. Saved (key: saved)

Indicates whether the Submit Form should be marked as saved
Required: no
Data Type: boolean

6. Prefilled fields (key: field)

Prefilled fields of the Form
Required: no
Data Type: dictionary any

7. Hidden Questions (key: hide)

Hidden Form Questions
Required: no
Data Type: dictionary boolean

Next Stages

1. Default (key: DEFAULT)

Stage to be executed when the operation ends

Outputs

1. Status (key: status)

Required: no
Data Type: boolean