Matching and Compliance Engine: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
Line 1: Line 1:
== Intro ==
== Intro ==
The 3B Compliance engine is a set of tools that allow system admins to define rules, conditions and restrictions that will apply on shifts that are booked as well as used as part of matching for relevant candidates
The 3B Compliance engine is a set of tools that allow system admins to define rules, conditions and restrictions that will apply on shifts that are booked as well as used as part of matching for relevant candidates
== Rule Types ==
When creating a Compliance Rule metadata, you can define the Type (b3s__Type__c) field to either "Scheduling" or "Clock In / Out Component" to designate the compliance rule for use either in the mobile app or in the scheduler. This way, you can have different compliance rules for internal users vs app users.


== Look Back and Look Forward Extension ==
== Look Back and Look Forward Extension ==
Line 12: Line 15:
A compliance rule has the following footprint:<syntaxhighlight lang="javascript">
A compliance rule has the following footprint:<syntaxhighlight lang="javascript">
async ({ event, events, contactId, loaders, EvaluationResult }) => {
async ({ event, events, contactId, loaders, EvaluationResult }) => {
return []
    let results = [];
    ...
   
    for (const missingCert of missingCerts) {
        results.push(
            new EvaluationResult({
                event: event,
                detail: `👎 Missing ${missingCert.b3s__Certificate_Type__r.Name}`,
                category: 'Certificates',
                points: -50,
                isBlocking: true
            }),
        );
    }
    return results;
}
}


</syntaxhighlight>As you can see, there are a number of parameters made available to your compliance rule:
</syntaxhighlight>As you can see, there are a number of parameters made available to your compliance rule:


* event - this is the contextual event that is being evaluated. Usually a shift, but it can also be an employee request
* '''event''' - this is the contextual event that is being evaluated. Usually a shift, but it can also be an employee request
* events - these are all of the loaded events in memory. This is where the lookBackExtendDays and lookForwardExtendDays come in handy, as you can load more data than displayed on the scheduler
* '''events''' - these are all of the loaded events in memory. This is where the lookBackExtendDays and lookForwardExtendDays come in handy, as you can load more data than displayed on the scheduler
* contactId - this is the contact’s id for evaluation. So, if we are trying to match a shift to a number of candidates, the rule will be re-ran for each candidate and the contactId will be the candidate’s id
* '''contactId''' - this is the contact’s id for evaluation. So, if we are trying to match a shift to a number of candidates, the rule will be re-ran for each candidate and the contactId will be the candidate’s id
* Loaders - this will be an array of loader objects that allow you to access additional data. The matchingLoaders property on the shift schedulable is an array where you can define the names of additional loaders
* '''loaders''' - this will be an array of loader objects that allow you to access additional data. The matchingLoaders property on the shift schedulable is an array where you can define the names of additional loaders
* EvaluationResult is a class that you must use to return the matching results from the result
* '''EvaluationResult -''' is a class that you must use to return the matching results from the result
Always return an array of '''EvaluationResult.'''
 
As of version 4.0, you can add "isBlocking" property to the '''EvaluationResult''' to indicate that this alert should block the scheduler from assigning/inviting the matched candidate or shift.


== Compliance Rule Loaders ==
== Compliance Rule Loaders ==

Navigation menu