Skip to main content

Set threshold notifications against Prepaid with Drawdown

Zuora

Set threshold notifications against Prepaid with Drawdown

You can set threshold notifications against the Prepaid Validity Period Summary data source for Prepaid with Drawdown through the API and the Zuora UI.

Note that in order to set up an email threshold notification, the availability of email templates and email template IDs is a prerequisite for creating such a notification definition. For more information about how to create email templates and generate email template IDs, see Manage email templates.

To set up an email threshold notification, perform the following steps:

  1. Use the Custom Event Triggers API operation to define a custom event. Determine the following mandatory fields specific to the custom event:

Field name 

Type

Description

active

boolean

The status of the event trigger.

baseObject

string

The base object that the trigger rule is defined upon.

For Prepaid with Drawdown, use ValidityPeriodSummary as the base object.

condition

string

The JEXL expression to be evaluated against object changes.

eventType

displayName

string

The display name for the event type.

name

string

The name of the event type.

You can use ValidityPeriodBalanceUpdated as the name.

Sample API request: Create a custom event. 

Request

POST https://{endpoint}/events/event-triggers

Request body

{

   "active": true,

   "baseObject": "ValidityPeriodSummary",

   "condition": "changeType == 'UPDATE'",

   "description": "Prepaid with Drawdown Threshold Notification",

   "eventType": {

       "description": "Prepaid with Drawdown Threshold Notification",

       "displayName": "Prepaid with Drawdown Threshold Notification",

       "name": "ValidityPeriodBalanceUpdated"

   }

}

  1. Use the Create a notification definition API operation to configure a notification definition. Determine the following mandatory fields specific to the notification:

Field name

Type

Description

eventTypeName

string

The name of the event type.

Note that the event type name here must be the same as it is in the preceding step.

filterRule

condition

string

The filter rule conditions, written in JEXL. The rule might contain event context merge fields and data source merge fields. Data source merge fields must be from the base object of the event or from the joined objects of the base object. Notifications with invalid merge fields will fail to evaluate, thus will not be invoked.

For Prepaid with Drawdown, use TotalPrepaidBalance and RemainingBalance fields from the ValidityPeriodSummary base object.

parameters

object (parameters)

The parameters of the filter rule and their name must match those in the filter rule. And all parameters must be defined in the event type payload. The name of parameters cannot be duplicated.

name

string

The name of the notification definition, unique per communication profile.

Sample API request: Create a notification definition.

Request

POST https://{endpoint}/notifications/notification-definitions

Request body

{

   "active": true,

   "calloutActive": false,

   "description": "Validity Period Threshold Notification",

   "emailActive": true,

   "emailTemplateId": "<your_email_template_ID>", 

   "communicationProfileId": "<your_communication_profile_ID>",

   "eventTypeName": "ValidityPeriodBalanceUpdated",

   "eventTypeNamespace":"user.notification",

   "filterRule": {

       "condition": "(_PPDD_VP_THRESHOLD_OPTIONS == \"percentage\" && ValidityPeriodSummary.TotalPrepaidBalance > ValidityPeriodSummary.RemainingBalance && (ValidityPeriodSummary.RemainingBalance*100 / ValidityPeriodSummary.TotalPrepaidBalance) < _PPDD_VP_THRESHOLD_VAL) || (_PPDD_VP_THRESHOLD_OPTIONS == \"units\" && (ValidityPeriodSummary.RemainingBalance < _PPDD_VP_THRESHOLD_VAL))",

       "description": "Filter rule to test if remaining balance < predefined threshold",

       "parameters": {

           "_PPDD_VP_THRESHOLD_OPTIONS": {

           "description": "remaining",

           "displayName": "Threshold by",

           "options": ["percentage", "units"],

           "valueType": "STRING"

           },

           "_PPDD_VP_THRESHOLD_VAL": {

               "description": " ",

               "displayName": "Validity period balance",

               "options": null,

               "valueType": "BIG_DECIMAL"

           }

       }

   },

   "filterRuleParams": {

       "_PPDD_VP_THRESHOLD_OPTIONS": "percentage",

       "_PPDD_VP_THRESHOLD_VAL": 20

   },

   "name": "Validity Period Summary Threshold Notification Notification"

}

By performing this step, you have created a threshold notification with two event parameters available. You can make your own adjustments according to your needs.

  1. Navigate to Platform > Events & Notifications in the left navigation menu. You can check and update notification configurations in the Notifications tab. Also, you can check the history of the email notifications sent in the Email History tab.