ProcessFormHandler Interface
Apex interface that processes the responses to forms submitted in a messaging
session.
Namespace
ProcessFormHandler Methods
The following are methods for ProcessFormHandler.
processFormRequest
Processes the form request and returns the ID of the record created during form
processing.
Signature
ID processFormRequest(RichMessaging.ProcessFormResponse formResponse)
Parameters
- formResponse
- Type: RichMessaging.ProcessFormResponse
- The form response.
ProcessFormHandler Example Implementation
The sample ContactApexFormHandler Apex class automatically captures the customer's submitted details, creates a Contact record in Salesforce, and returns the Contact record ID.
This is an example implementation of the RichMessaging.ProcessFormHandler interface.
1global class ContactApexFormHandler implements Richmessaging.ProcessFormHandler{
2 global ID
3 processFormRequest(RichMessaging.ProcessFormResponse formResponse) {
4 // Create a new Contact object
5 Contact newContact = new Contact(
6 Phone = formResponse.formValues.get('Phone'),
7 Salutation = formResponse.formValues.get('Salutation'),
8 Email = formResponse.formValues.get('Email')
9 );
10 // Insert the new contact into the database
11 insert newContact;
12 // Return the ID of the newly created contact
13 return newContact.Id;For more information, see "Create a Form Based on an Apex Class" in this help topic.