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.
global class ContactApexFormHandler implements Richmessaging.ProcessFormHandler{
global ID
processFormRequest(RichMessaging.ProcessFormResponse formResponse) {
// Create a new Contact object
Contact newContact = new Contact(
Phone = formResponse.formValues.get('Phone'),
Salutation = formResponse.formValues.get('Salutation'),
Email = formResponse.formValues.get('Email')
);
// Insert the new contact into the database
insert newContact;
// Return the ID of the newly created contact
return newContact.Id;
For more information, see "Create a Form Based on an Apex Class" in this help topic.