sfAddSystemTriggerAction
Requests the server for a system action like send an email or create a report.
This function is for advanced customization of system action requests. For simpler implementations, refer to
sfCreateDocument - to generate a report of a form, usually in PDF format
sfSendEmail - to send an email, optionally along with a print document of a form
When this function is executed in the browser or in the mobile app, it sends a request to the server for the system action to be executed. The action is always executed on the server (and never directly from the browser or the mobile app).
Syntax
sfAddSystemTriggerAction (action, actionParameters, immediateMode)
Parameters
Name | Type | Mandatory | Description |
---|---|---|---|
action | string | yes | Name of the system action to be executed.
|
actionParameters | json | yes | Parameters required to execute the requested system action. The parameters are different for each action. Click here for the parameters supported for each action. |
immediateMode | boolean | yes | Indicates if the system action should be request immediately or wait until the user saves the current form. |
actionParameters
Each system action requires a set of action parameters to correctly execute the request. The parameters supported for each different.
SEND_EMAIL
Signature
sfAddSystemTriggerAction("SEND_EMAIL",
"{
'emailTemplateName': '',
'emailAttributes': {
'nameFrom': '',
'emailAddressFrom': '',
'emailAddressTo': '',
'emailAddressCc': '',
'emailAddressBcc': '',
'subject': '',
'emailBody': ''
},
'attachments': [{
'type': 'FORM_DOCUMENT',
'name': '',
'formId' : 'uniqueidentifier',
'path': 'Default_Path;Server.InterfacePath',
'reportName': '',
'params': {
'paramName': 'paramValue'
}
},{
'type': 'FORM_FILES',
'formId' : 'uniqueidentifier',
'expression': '.*pdf$'
}],
'referenceFormId': 'uniqueidentifier',
'execution': 'IMMEDIATE/BATCH',
'runtimeReference': ''
}",
true/false);
Parameters
Name | Type | Mandatory | Description |
---|---|---|---|
emailTemplateName | string | no | Name of the email template that contains the email configuration like the recipients, email subject and email body. It is optional if all required email configuration is sent as emailAttributes. |
emailAttributes | json | no | Email configuration details for the email to be sent out.
If an email template is not used (i.e. emailTemplateName is skipped), then at least the sender name, sender email, subject, body and at least one recipient must be mentioned in emailAttributes. If an email template is mentioned along with the email attributes, then the attribute provided in emailAttributes is preferred over the conflicting attribute in the mentioned email template. If the sender email address does not belong to smartflowcloud.com domain, the server may reject the emails. Contact the support team to verify if the desired domain is supported. |
attachments | json | no | Details of the attachments to be included in the email. To attach a report file,
To attach the form files,
|
referenceFormId | guid | no | Form reference to be used to fetch data for placeholders in the email attributes and body. By default, the form that triggered the email request is used as reference. |
execution | string | no | IMMEDIATE/BATCH |
runtimeReference | string | no |
|
Usage examples
To send an email using email template OperationalAgreement_Completed along with the print of the form using report template OperationAgreementPrint as attachment,
sfAddSystemTriggerAction("SEND_EMAIL",
"{
'emailTemplateName': 'OperationalAgreement_Completed',
'attachments': [{
'type': 'FORM_DOCUMENT'
}]
}",
true/false);
To pass runtime parameters to be used during print generation,
sfAddSystemTriggerAction("SEND_EMAIL",
"{
'emailTemplateName': 'OperationalAgreement_Completed',
'attachments': [{
'type': 'FORM_DOCUMENT',
'params': {
'SummaryOverview': 'show'
}
}]
}",
true/false);
To use a different print format (report template) OperationAgreementPrint instead of the default print format configured for the form,
To use a different recipient and subject instead of the ones defined in the email template,
CREATE_DOCUMENT
Signature
Parameters
Name | Type | Mandatory | Description |
---|---|---|---|
name | string | no | Name to be used for the generated report file. If a name is not provided, a default name is assigned by the system in format: <Form Template Name>_<Current User Display Name>_<DDMMYYYY>_<HHmmssSSS>_<3 Digit Random Number> |
formId | json | no | Identifier of the form the report should be generated from. If no identifier is mentioned, the current form in the context is considered. |
path | string | no | Relative path on the server where the generated document should be stored.
If no value is provided, the document is stored in the default path. |
type | string | yes | PDF/XML |
reportName | string | no | In case of RDL reports, name of the RDL report to be used to generate the PDF. |
params | json | no | Key-Value pairs of parameters to be sent to the document generation process. |
referenceFormId | guid | no | Form reference to be used to fetch data for placeholders in the email attributes and body. By default, the form that triggered the email request is used as reference. |
execution | string | no | IMMEDIATE/BATCH |
runtimeReference | string | no |
|
Usage examples