Send Docs Feedback

Note: Most user interface tasks can be performed in Edge Classic or the New Edge experience. For an overview, getting started topics, and release notes specific to the New Edge experience, see the docs.

Create and configure rules

The Drupal Rules module lets you define a rule that specifies the action that occurs automatically in response to an event on the portal. For example, you can create a rule to automatically add a default app (action) to all new developer accounts (event). Or, you can create a rule to redirect a user to a specific page (action) on log in (event). Add and manage user accounts shows how to define those two rules.

The Drupal Rules module tracks events that are performed using the portal only. It does not track equivalent events that are performed using Apigee Edge. For example, if you have defined a rule that tracks when an app is updated, if an app is updated using the dev portal, the action will be triggered. If the app is updated using Apigee Edge, no action will be triggered.

The Rules module is very flexible and you can use it to create many different types of rules. A subset of the events include:

  • Adding, updating or deleting a developer app
  • Changing the status of a developer app
  • Adding, updating, or deleting a developer account
  • Adding, updating, or deleting a portal node
  • Drupal is initialized
  • A Drupal log entry is created

A subset of the types of actions that can be performed include:

  • Sending an email to an individual or group
  • Blocking a user
  • Promoting content
  • Showing a message on the site
  • Performing a page redirect
  • Blocking an IP address

If the event is the changing of the status of an app, and the action is to send an email, then the email is sent the next time the portal's cron job runs. In Edge for Private Cloud installations, you can set the frequency of the cron job to as short as one minute. In Edge cloud, the minimum frequency is one hour. 

To set the frequency of the cron job, select Configuration > System > Cron in the Drupal administration menu.

To manually trigger the cron job, select the Home icon > Run cron.

You can also add conditions to rules, for example to test the role of a developer, as part of processing the rule. 

For a compete list of capabilities, see the documentation on the Drupal Rules module.

Enabling rules

Before you can create a rule, you muse ensure that all the necessary Drupal modules are enabled.

To enable the necessary Drupal modules:

  1. Log in to your portal as a user with admin privileges.
  2. Select Modules in the Drupal administration menu.
  3. Enable the following modules if they are not already enabled:
    • Rules
    • Rules UI
  4. Save the configuration.
    You might see other required modules being enabled automatically.

Creating a rule

In this example, you create a rule to notify administrators when a developer create a new app on the portal.

This example generates an email when the developer create a new app. You must configure SMTP on the portal for the email to be generated. See Configuring email for more. 

To create a rule:

  1. Log in to your portal as a user with admin privileges.
  2. Select Configuration > Workflow > Rules in the Drupal administration menu.
  3. Select + Add new rule on the Rules page.
  4. Specify the Name of the rule. For example Email on app creation.
  5. Optionally specify a tag as app_creation.
  6. In the React on event dropdown box, select Devconnect > Upon creation of a developer app.
  7. Select Save
    The Editing reaction rule page appears. You already set the event in the previous step, so it should say Upon creation of a developer app in under Events. Leave Conditions blank for this rule.
  8. Under Actions, select + Add action.
  9. Select System > Send mail in the dropdown.
    The Add a new action page changes its layout to let you specify email information.
  10. Edit all information including the email recipients, message body, sender, and other information.
  11. Click Save to return to the Editing reaction rule page. 
  12. Click Save changes.

    Now when a developer creates an app, an email is automatically sent to the list of recipients specified by the rule.  

Editing or deleting a rule

After you create a rule, you can later edit or delete the rule.

To edit or update a rule:

  1. Log in to your portal as a user with admin privileges.
  2. Select Configuration > Workflow > Rules in the Drupal administration menu.
  3. Select the rule to edit or delete.

Help or comments?