-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add form event hooks #210
Comments
We should also support a handful of built-in behaviors, like |
Implement send_mail:
template: form_created
method: static
target: [email protected] Where the template points to one of the template names in the email config, method is an enum of ['static', 'group', and 'relationship'], and target is the value used to select the emails to send, based on the method. So, the example above will always send Bob a form_created email to [email protected] when a form is submitted. But, if we wanted to send this to all members of the send_mail:
template: form_created
method: group
target: default |
Implement set_value:
selector_method: from_field
value_method: static
target_form_name: leave_requests
target_field_name: approval_status
target_document_id: request_id
value: "approved" This logic is a little more complex, because we need to choose methods for two things: first, how to select the submission to assign the value to; second, how to select the value to assign to that submission. For this, we create selector_method and value_method, respectively. These are enums of ['static', 'from_field']. If selector_method is assigned "static", then target_document_id should be a assigned an actual document ID like 664eab5c46c99199a7b22ab7. If it is assigned "from_field", then target_document_id should be assigned a field that exists in the form that has just triggered the event handler - which should contain a document_id value. Likewise, if value_method is set to "static", then value is expected to be a static value; but, if value_method is set to "from_form", then value should correspond to a form field in the form that has just triggered the event handler, see example below. set_value:
selector_method: from_field
value_method: from_field
target_form_name: leave_requests
target_field_name: approver
target_document_id: request_id
value: __metadata__created_by target_form_name and target_field_name should be static values. |
Add a |
RelationshipType reciprocal_name should be nullable but unique if set |
Implement create_submission:
form_name: example_form
values:
field_name_1:
method: static
value: "This text will always be the same"
field_name_2:
method: from_field
value: some_field_name
field_name_3:
method: from_field
value: __metadata__some_metadata_field This will create an |
Implement - type: http_request
target: https://api.jira.com/api/v1/create/
method: post
headers:
X-API-KEY:
value_method: static
value: laksjdfhkjasdhfwj2317-sas-d
body:
request_type:
value_method: from_form
value: request_type
description:
value_method: jinja2
value: "This is the description of a {{request_type}} submitted by {{__metadata__created_by}}" This will submit an http request to the designated target and include the relevant headers and body passed by the system. You also need to specify the HTTP method (get, post, patch, put, delete) for the request. There are three ways to pass data: static, from_form, and jinja2. Jinja2 will allow you to embed values from within the form itself into a jinja2 string. |
This should be special behavior on certain event triggers, like:
on_duplicateSpecial event hooks like onApproval / onDisapproval will make more sense to implement using the approval process, see #62 and #39.
The text was updated successfully, but these errors were encountered: