Transact Function Triggers

   Journey Manager (JM) The transaction engine for the platform.  |    Form Builder Platform Developer |  17.10 This feature was introduced in 17.10.

Journey Manager provides the API methods to trigger various server-side services at the pre-defined points of the application life cycle, such as Form Open, Form Resume, and so on, that a form user initiates while navigating through a form. The server-side services are fluent functions, which you create to implement customer onboarding journeys. For an application to call a fluent function, it must be associated with a form version; we call these services Transact Functions.

Transact Functions provide an improved programming model for client applications to call server-side business functions. Form Functions are designed for applications to make calls to other systems for doing remote data look-ups or executing some secure business logic on the server. They provide the modern replacement for Form Dynamic Data Services but with an improved programming and security model. Fluent functions can be invoked with a variety of form function triggers.

Note

The form function trigger doesn't provide automatic support for transaction updates, so you need to use the fluent functions with a Form Update trigger for automatic persistence. The Form Functions are for light weight calls, such as data look-ups or type ahead queries.

Manager comes with the following Transact Function triggers:

Let's look at each trigger type and review its use cases.

Form Open

This trigger is initiated by the Manager server when a new form transaction is created, immediately before it is rendered in a browser.

You can use this trigger to:

  • Prefill data into an application.

Form Resume

This trigger is initiated by the Manager server when a saved form transaction is resumed, immediately before it is rendered in a browser.

You can use this trigger to:

  • Prefill data specific to a returning user into an application.

Form Save Challenge

This trigger is initiated by the Manager server when a save challenge is performed.

Form Update

This trigger is initiated by the application when the form makes an background update operation.

You can use this trigger to:

  • Send and retrieve data on a page and route change.
  • Add and remove an attachment.

Form Ineligible

This trigger is initiated by the application's business rule scripts in the browser after determining the user is ineligible to complete an application.

You can use this trigger to:

  • Send an email to the customer saying they are ineligible for this application form.

Form Function

This trigger is generally initiated by the application to get dynamic data from the server and perform any transaction updates.

You can use this trigger to:

  • Retrieve an address list based on an input parameter.
  • Validate a user account.

User Save

This trigger is initiated by a user of the application when the user explicitly saves and closes the application.

You can use this trigger to:

  • Send a custom save and resume email to a user. This can be an alternative to auto-generated confirmation emails sent by Journey Manager when you need a better control of a submission flow.
  • Expire a user's session.

User Submit

This trigger is initiated by a user of the application when the user explicitly submits a completed form application.

You can use this trigger to:

  • Send a custom submission completed email to a user.
  • Send data to a back office data server.

The example of a fluent function that is triggered by the User Submit is shown below:

import com.avoka.tm.func.*
import com.avoka.tm.svc.*
import com.avoka.tm.util.*
import com.avoka.tm.vo.*
import groovy.transform.TypeChecked
import javax.servlet.http.*
import com.avoka.tm.query.*

@TypeChecked
class FluentFunction {
    // Injected at runtime
    public Logger logger
    
    FuncResult invoke(FuncParam param) {
		// Get the Email Template
		String eMailTemplate = new PropertyQuery()
			.setName("OnboardingTemplate1")
			.setClientCode("KNOW1")
			.getValue()
		//Get the key values for the email message from the submitted data
		XmlDoc xmlDoc = new XmlDoc(param.appDoc)
		String businessName = xmlDoc.getText('/Root/AvokaSmartForm/Cust/BusinessName')
		String custFirstName = xmlDoc.getText('/Root/AvokaSmartForm/Cust/FirstName')
		String trackingCode = xmlDoc.getText('/Root/AvokaSmartForm/SFMData/SystemProfile/TrackingCode')
		String custEmail = xmlDoc.getText('/Root/AvokaSmartForm/Cust/EmailAddress')
		
		custEmail = custEmail.trim()
		String emailMessage  = new VelTemplate()
			.setTemplate(eMailTemplate)
			.addModelValue("customer", businessName)
			.addModelValue("accessCode", trackingCode)
			.addModelValue("custFirstName",custFirstName)
			.merge()
		new Emailer()
			.setToAddress(custEmail)
			.setSubject("Onboarding Survey")
			.setMessage(emailMessage)
			.sendEmail()
		FormFuncResult result = new FormFuncResult()
        return result
    }
}

User Cancel

This trigger is initiated by a user of the application when the user explicitly cancels and closes a form application.

You can use this trigger to:

  • Send a custom abandoned email to a user.

Next, learn how to configure triggers.