bookmark_borderNotifications Object

Introduction

The Notifications Object is an associative array containing the properties for all the email notifications which exist for a form. On a default installation when a new form is created a single notification, named Admin Notification, is created for the form. There is no limit to the number of additional notifications you can create.

See the Configuring Notifications in Gravity Forms article for a tutorial showing how you can configure notifications in the admin.

$form['notifications'] = array(
	'558a90489ced3' => array(
		'isActive'          => true,
		'id'                => '558a90489ced3',
		'name'              => 'Admin Notification',
		'event'             => 'form_submission',
		'to'                => '{admin_email}',
		'toType'            => 'email',
		'subject'           => 'New submission from {form_title}',
		'message'           => '{all_fields}',
		'from'              => '{admin_email}',
		'disableAutoformat' => false,
	),
	'558a905b98b18' => array(
		'isActive'          => true,
		'id'                => '558a905b98b18',
		'name'              => 'User Notification',
		'event'             => 'form_submission',
		'to'                => '2',
		'toType'            => 'field',
		'subject'           => 'Thanks for your form submission',
		'message'           => '{all_fields}',
		'from'              => '{admin_email}',
		'conditionalLogic'  => array(
			'actionType' => 'show',
			'logicType'  => 'all',
			'rules'      => array(
				array(
					'fieldId'  => '3',
					'operator' => 'is',
					'value'    => 'Email me a copy',
				),
			),
		),
		'disableAutoformat' => false,
	),
);

Usage

The Notification Object is part of the and so is most commonly accessed like so:

$notifications = $form['notifications'];

Notification Properties

Each notification is an associative array which can use the following properties.

  • isActive boolean

    Is the notification active or inactive. The default is true (active).

  • id string

    The notification ID. A 13 character unique ID.

  • name string

    The notification name.

  • service string

    The name of the service to be used when sending this notification. Default is wordpress.

  • event string

    The notification event. Default is form_submission.

  • to string

    The ID of an email field, an email address or merge tag to be used as the email to address.

  • toType string

    Identifies what to use for the notification to. Possible values: email, field, routing or hidden

  • bcc string

    The email or merge tags to be used as the email bcc address.

  • subject string

    The email subject line. Merge tags supported.

  • message string

    The email body/content. Merge tags supported.

  • from string

    The email or merge tag to be used as the email from address.

  • fromName string

    The text or merge tag to be used as the email from name.

  • replyTo string

    The email or merge tags to be used as the email reply to address.

  • routing array

    An indexed array containing the routing rules. See Routing Rule Properties properties for each rule.

  • conditionalLogic array

    An associative array containing the conditional logic rules. See the Conditional Logic Object for more details.

  • disableAutoformat boolean

    Determines if the email message should be formatted so that paragraphs are automatically added for new lines. Default is false (auto-formatting enabled).

Routing Rule Properties

Each routing rule is an associative array containing the following properties.

array(
	'fieldId'  => '3',
	'operator' => 'is',
	'value'    => 'Email me a copy',
	'email'    => '{admin_email}',
)
  • fieldId string

    Target field ID. The field that will have it’s value compared with the value property to determine if this rule is a match.

  • operator string

    Operator to be used when evaluating this rule. Possible values: is, isnot, >, <, contains, starts_with, or ends_with.

  • value string

    The value to compare with the field specified by fieldId.

  • email string

    The email or merge tag to be used as the email To address if this rule is a match.