Overview
When pricing an opportunity in PrecisionLender, application events are sent to Andi® to notify her of changes to the opportunity. The change event powers target engine model (financial) events in the Opportunity context that can be used to determine whether or not a skill should run.
In this Article
- What are the change event powers?
- When to use the change event powers
- How to call the change event powers
What are the change event powers?
The change event powers are a boolean power type that when called, will determine whether it is true or false that an engine change event occurred.
The available change event powers are:
- isLoanAccountChangeEvent - when a log-engine-change event occurs
- isDepositAccountChangeEvent - when a log-engine-change-deposit event occurs
- isOtherAccountChangeEvent - when a log-engine-change-other event occurs
- isOpportunityChangeEvent - when any of the three log-engine change events occur
When to use change event powers
You should use the change event powers when writing the shouldIRun code for a skill that should run when an engine change event occurs, without having to specify (or remember) the specific engine event name(s).
For example, if you want a skill to run when there's a change made to any product being priced in an opportunity that impacts the financial statement, you would use the isOpportunityChangeEvent power.
How to call the change event powers
The change event powers will be called via the opportunity property of the PrecisionLender context.
skillContext.powers.precisionLender.opportunity.yourChosenChangeEvent()
Using isOpportunityChangeEvent as an example, you could write your shouldIRun for a skill that should only run if an engine change occurs for any product in an opportunity as follows:
let opportunityChangeEvent = skillContext.powers.precisionLender.opportunity.isOpportunityChangeEvent()
if(opportunityChangeEvent)
return skillContext.powers.andi.shouldIRun.shouldIRunTrue();
return skillContext.powers.andi.shouldIRun.shouldIRunFalse();