Working With Data Scanners
You can define Data Scanner Rules for fields of the objects for which you configure Data Scanners by grouping rules and using logical operators (AND, OR) to connect them. To specify the records to which the rule should be applied, you can also define Data Scan Filters. Additionally, you can define Data Scanner Rules for fields of the target objects of Relationship fields. The maximum depth of these relationships is 3.
Data Scanner Rules
Newly created Data Scanner records are inactive by default, and cannot be used to scan records until they are activated. Before you activate Data Scanners, you must define Data Scanner Rules. After Data Scanners are activated, Data Scanner Rules cannot be edited, and scans are automatically triggered when records are created, updated, or deleted. You can then manually trigger a data scan, or configure a System Job to trigger full scans at specified time intervals.
Data Scan Filters
To specify the records to which to apply Data Scanner Rules, you can define Data Scan Filters. For example, if you define a Data Scanner Rule which returns only records that have a Status field value of New and a Preferred Start Time field value of up to 30 minutes from the current time, you can define a filter to apply the rule only to Job records with a Priority field value of High.
Scan Results
You can make scan results visible by linking the Captured by Data Scanner field to the object for which scans are triggered. This field is automatically selected when records violate Data Scanner Rules, which makes the records in violation visible in scan results. After you link this field, a multiple Relationship with the name Object Name Data Scanners is automatically created, for example, Job Data Scanners. The Source Object field is used to specify the object to be scanned, and the Target Object field is used to specify the Data Scanner object. Additionally, when you link this field, the Captured by Data Scanner Updated On field, which is populated with the time of the most recent update to the Captured by Data Scanner field, is automatically linked to the same object. After these fields are configured, Captured by Data Scanner field values are selected in cases where records are in violation of at least one Data Scanner Rule to provide dispatchers with visible indications of violations.
|
• Service Board ships with the Captured by Data Scanner and Captured by Data Scanner On fields linked to the Job and Appointment objects by default.
• The In Jeopardy field in the Job object is selected when Captured by Data Scanner fields in Job records or in related Appointment records are selected.
• Updates to the Captured by Data Scanner, Captured by Data Scanner Updated On, and In Jeopardy fields do not trigger HTTP Notifications, and therefore cannot be synced to Salesforce.
|
Post Actions
Data Scanners also support Post Actions, which are object-level and Data Scanner-level Operations that are executed after both full and automatic data scans are successfully completed. Object-level Post Actions are executed first, followed by Data Scanner-level Post Actions, and use the following parameters.
Name
|
Class
|
|
Description
|
matched
|
java.util.List
Elements: java.util.UUID
|
IDs of records in violation of the rule
|
notMatched
|
IDs of records not in violation of the rule
|
objectDef
|
com.intalio.core.seed.api.IEntityManagerDefinition
|
Definition of object whose records were scanned
|
dataScannerId
|
java.util.UUID
|
Data Scanner record ID
|
scanMode
|
com.servicemax.core.seed.internal.datascan.DataScanMode
|
DataScanMode.full, DataScanMode.onTheFly, or DataScanMode.ruleDisabled
|
triggeredBy
|
java.util.UUID
|
User ID that triggered the data scan
|
Groovy Source Code Example
import com.intalio.core.seed.api.IEntityManagerDefinition
import com.servicemax.core.Database
import com.servicemax.core.seed.internal.datascan.DataScanMode
class CustomPostAction {
public Object execute(Map params) {
List matchedRecordIds = params['matched']
List notMatchedRecordIds = params['notMatched']
UUID dataScannerId = params['dataScannerId']
DataScanMode scanMode = params['scanMode']
UUID triggeredByUser = params['triggeredBy']
IEntityManagerDefinition relatedObject = params['objectDef']
List matchedRecords = Database.queryAsList("SELECT * FROM ${relatedObject.getFullIdentifier()} WHERE io_uuid IN :matchedIds", [matchedIds: matchedRecordIds])
List notMatchedRecords = Database.queryAsList("SELECT * FROM ${relatedObject.getFullIdentifier()} WHERE io_uuid IN :notMatchedIds", [notMatchedIds: notMatchedRecordIds])
... // do the rest work with the records.
}
}
For details on how to define
Post Actions, see
Defining a Source Record and
Defining an Operation Record for a Source in
Max for Developers.
When you link users, groups, or roles to Data Scanner records as subscribers, email notifications are sent to users who trigger full scans after success or failure. Linked users and users related to the linked groups and roles are also notified.
|
• Email notifications are sent only to users with related User records in which the Authenticated and Active check boxes are selected.
• Email addresses are retrieved from the Email field in User Contact records.
• The Data Scan Completed record of the Email Notification Request object must be activated. Email templates are defined in this record, which you can update per your requirements.
|
Service Board ships with the following predefined inactive Data Scanner records for use as templates, which can be activated, but cannot be updated.
• Appointment Data Scanners
◦ The scheduled end time for the Appointment has been reached and work is not completed.
◦ The technician has not started work on the Appointment, and the scheduled time has passed.
• Job Data Scanners
◦ The preferred start time for the Job is getting close and no Appointments are scheduled.
You can copy and modify these predefined Data Scanners or create new Data Scanners as your organizational needs dictate.
For more information: