Step 1- Create Watcher for a record

Watchers can be configured to watch changes that have been made to records or views. On this page, you can specify the record to be monitored, fields to which the conditions are applied, and the actions that are taken when the conditions are met.

To create a Watcher, go to, Dashboard > Watchers > Add new 

To edit an existing Watchers definitions, go to, Dashboard Watchers, and then select a Watcher from the list.

FieldDescription 

Watcher details

ID

Required. Enter an ID for the Watcher.  

This field is editable only when the Watcher is created and is displayed as a read-only field when editing the Watcher.

Watch a viewEnable to create a watcher for a view. 

Record Type/View Type

Required. From the drop-down, select the record type or view type for which you want to create a watcher.

This field is editable only when the watcher is created and is displayed as a read-only field when editing the watcher.

Permissions

Permissions can be set  to allow users in a group to:

  • Read the definition: Users can only view the watcher definition
  • Edit the definition: Users can only edit the watcher definition
  • Read and edit the definition: Users can view and edit the watcher definition

Group name: Enter the name of the group

Ensure that you set the required permissions for a record definition before you save it. If you fail to do so, users (including the creator of the record definition) are not allowed to view or edit it.

Conditions

The condition is displayed in the Conditions section. Set conditions using the following options. 

A matching condition, for instance, "When the City (Field name) is equal to (predicate) London (Value)" can be set here. 

  • Field name: Select a field name from the drop-down. 

    The list may display fields that are set to not be displayed in the table.

  • Predicate: You can use predicates like contains, is equal to, is not equal to, contains, does not contain, etc. to generate search results when the set conditions are met. 
  • Value:  Enter a value to match the predicate settings. 

Clickto delete existing conditions.

Actions

When the set conditions are met, you can choose to send an email, to make outgoing API calls to other systems, or use a custom plugin.

Send an email

To send an email you can set the following details: 

  • From: Enter an email address to notify the user who has sent the email
  • Subject: Enter the subject of the email message
  • Recipients: Click the option to add multiple recipients. Enter an email address of the recipients.

    • If you have an email field in your record, you can set the Recipients field to {{record.fields.<fieldname>}}. When the watcher conditions are met, the email ID is automatically generated using the value set in that field in the record.
  • Email body: Type your message to explain the purpose of the email. You can format the email using HTML code. You can insert variable tags in your email that are replaced with dynamic data. For more information see, Using variable tags for mapping fields.
  • Preview: Displays a preview of the email

Make an API call

The system can also make an outgoing API call in response to an observed event.

API settings:

  • URL to call: Type the address that points to external server/service
  • Request method:
    • GET: Used to retrieve information from the server
    • POST: Used to send a create or update request to the server. When two identical POST requests are made, it most likely results in creating two resources with the same information.
    • PUT: Like the POST request, the PUT request sends an update request to the server. However, the very first request updates the resource and subsequent requests only overwrite the same resource, without changing anything.
    • DELETE: Used to send a request to remove a resource from the server. 

Successful HTTP Status codes: Enter a status code to represent how the request was processed. Status codes are expressed through 3-digit numbers.  

  • Match/Predicate/Value: Enter the JSONPath or XPath (Match) along with a Predicate and a Value to match. You can use predicates like contains, is equal to, is not equal to, contains, does not contain, etc. to apply triggers when the set conditions are met. 

Headers: Headers are used to give server instructions about the variables in the request. Click Add to add more headers.

  • Header name: Name for the header. For example, Content-Type headers describe the content being sent or requested within an HTTP request. When you add a new API call action a Content-Type header set to ‘application/json’ is added by default.
  • Header value: The media type of the response sent to the client by the server, which helps the client to process the response body. For example, when sending data, setting the Header name to Content-Type and Value to application/xml tells the client that the data being sent in the request is XML. Similarly, you can set the value to application/json if it is requesting a response in JSON.  

Fields: In this section, you can define the parameters that are sent and processed when the API call is made. The request can be to create, update, delete or request data. Click Add to add multiple fields.

  • Field name: Enter a variable for the field
  • Field value: Enter a value or use a variable to replace the value. For example, {{record.fields.Year}}.

    • The Use raw body option is displayed only for POST and PUT requests. 
    • You can insert variable tags that are replaced with dynamic data. For more information see, Using variable tags for mapping fields.
  • Use raw body:   

Using a custom plugin

Predefined plugins (API and email) are provided with the WatcherSubscriber. You can, however, add other capabilities by writing custom plugins. For example, you can create a custom plugin which communicates with an external system when the watcher conditions are met. An example of this could be where you want to automatically trigger a purchase order to be generated on your SAP system if the watcher detects a parameter change in a record. You could write your own plugin to take to output of the watcher and pass it to your SAP system for processing.

If you are setting up a custom plugin, ensure that you start the custom plugin also with the predefined plugins when starting the WatcherSubscriber.

  • Plugin name: The name for the custom plugin.
  • Fields: In this section, you can define custom actions using a plugin. Click Add to add multiple fields.
    • Field name: Enter a label or title for the field
    • Field value: Enter a value or use a variable to replace the value. For example, {{record.fields.Year}}.

Retry: The option is disabled by default. If enabled, watchers automatically re-tries the action that failed.

Click Save to save your changes. Click Revert changes to undo the current changes and revert to the last saved version.