Overview
When pricing an opportunity in PrecisionLender, application events are sent to Andi® to notify her of changes to the opportunity. These application events can be used to determine whether a skill should run or how it should execute. You can target these Application Events within the Opportunity context in Andi® and retrieve accompanying data from the Opportunity Model.
In This Article
Event Structure
Application Events are represented as a JSON object. Every Application Event will consist of the following structure:
eventCounter: number; // each event will have its own, unique payload.
id: string;
tenantId: string;
organizationId: string;
applicationId: string;
context: string;
currentContext?: string;
associatedViewContext?: {id: string, [prop: string]: any};
currentlyViewedContext?: { id: string; [prop: string]: any; }[];
fullContext?: string;
conversationId: string;
eventMetaData?: any;
//currently {
userEmail: string;
userFullName: string;
userId: string;
username: string
}
userId: string;
inboundChannel: ISkillChannel;
eventType: EventTypes; //e.g. Application Event
eventStartTs?: number;
eventArrivalTs?: number;
eventDepartureTs?: number;
locale:string;
applicationEventName: string; // e.g. "OpportunityCreated", "OpportunityStageChanged",
applicationEventData: any; // e.g. the opportunityModel properties for an event
Referencing an Application Event
Events may not appear via intellisense when you write your code.
Using a Power
To reference an application event, cast a variable using the getApplicationEvent power and then define an event variable to pass that variable with the event name
let yourVariableName = skillContext.powers.andi.event.getApplicationEvent(); let yourEventVariableName = yourVariableName && yourVariableName.applicationEventName && yourVariableName.applicationEventName.startsWith("theEventName")
Example:
let anEvent = skillContext.powers.andi.event.getApplicationEvent(); let scenarioRecalculated = anEvent && anEvent.applicationEventName && anEvent.applicationEventName.startsWith("scenarioRecalculated");
Without Using a Power
To reference an application event, cast a variable using IApplicationEvent from the skillContext. Then use that variable to define your variable with the event name. This will also allow you the ability to use intellisense to view the full IApplicationEvent shape.
let applicationEvent = skillContext.event as andiSkills.IApplicationEvent;
let yourVariableName = applicationEvent.applicationEventName && applicationEvent.applicationEventName === "theEventName"
Example:
let event = skillContext.event as andiSkills.IApplicationEvent;
let scenarioRecalculated = event.applicationEventName && event.applicationEventName === "scenarioRecalculated";
Helpful Tip
If you're unsure of what event or event properties you may need to reference from the list below, follow the steps below to see the events using Developer Tools for the following web browsers:
- In Chrome
-
Open or create an opportunity in PrecisionLender
-
Open the Developer Console in your browser
-
Select Network
-
Search and Filter on 'events'
-
Under the Headers section, expand 'Request Payload'
-
Perform the desired end user action in the opportunity in PrecisionLender.
-
All resulting events will show as their own 'event' in the request payload. Select an event to view its properties.
- In Internet Explorer
-
Open or create an opportunity in PrecisionLender
-
Open the Developer Console in your browser
-
Select Network
-
Perform the desired end user action in the opportunity in PrecisionLender.
-
All resulting events will show with a Name/Path of 'event' in the content pane.
-
Select an 'event' in the response to view its properties in the 'Request body' tab of the Body section.
Application Events
Event Name & Occurrence | applicationEventData (Opportunity Model Properties) |
---|---|
opportunityLoaded When a user opens an existing opportunity |
|
opportunityCreated When a user creates a new opportunity |
|
opportunityNameChanged When a user changes the name of an opportunity. |
|
opportunitySaved When a user saves their opportunity. |
|
opportunitySavedClick When a user clicks 'Save' on a pop-up or the save button in the opportunity. |
|
opportunityTransferred When a user transfers an opportunity to another user and saves the transfer. |
|
opportunityDeleted When a user deletes an opportunity. |
|
opportunityCloseDateChanged When a user changes the close date in the opportunity. |
|
Back to top | |
opportunityStageChanged When a user changes the stage of the opportunity. |
|
opportunityRelationshipChanged When a user changes or removes the relationship attached to an opportunity. |
|
opportunityNotesChanged When a user adds or updates notes in the Notes tab of an opportunity. |
|
opportunityPrintedFullOpportunity When a user generates the Full Opportunity printout. |
|
opportunityPrintedOpportunitySummary When a user generates the Executive Summary printout. |
|
opportunityPrintedRelationshipImpactSummary When a user generates the Executive Summary - Relationship Impact printout for an opportunity with an attached relationship. |
|
opportunityPrintedBorrowerSummary When a user generates the Borrower Summary printout. |
|
opportunityPrintedOpportunityPipeline When a user generates the Opportunity Pipeline printout. |
|
Back to top | |
opportunityPrintedScenarioComparison When a user generates the Scenario Comparison printout. |
|
opportunityRecalculated When an external change is made to an opportunity such as the addition, changing, or removal of a relationship or a change in the assumption set. |
|
opportunityRelationshipRecalculated When a user makes a change to an opportunity with an attached relationship that results in an update to the relationship profitability, such as payoff/renewals, the addition of a loan, deposit, or other product, etc. |
|
scenarioRecalculated When a user makes a change to, addition, or removal of any product (loan, deposit, or other) for the current scenario being priced in an opportunity. |
|
opportunityCurrentScenarioChanged When a user makes a change to the current scenario being priced, adds a scenario to, or removes a scenario from an opportunity. |
|
scenarioAdded When a user adds a scenario to an opportunity. |
|
scenarioRemoved When a users selects 'Remove Scenario' in the scenario builder. |
|
Back to top | |
scenarioDuplicated When a user selects 'Duplicate Scenario' in the scenario builder or the camera icon on the opportunity screen to create a new scenario. |
|
scenarioNameChanged When a user changes the name of a scenario in an opportunity, clicks 'Duplicate Scenario' or makes a change to a field in the scenario being priced that is also included in the scenario name, such as Fees and LTV, when no custom scenario name has been added. |
|
scenarioEmailed When a user selects 'Email Scenario Link' for a scenario in an opportunity. |
|
scenarioLinkCopied When a user selects 'Copy Scenario Link' for a scenario in an opportunity. |
|
opportunityPipelineScenarioChanged When a user selects 'Make Pipeline Scenario' or removes the pipeline scenario in an opportunity. |
|
scenarioCompetitorChanged When a user indicates a scenario as competitive or changes a competitive scenario to an alternative scenario in an opportunity. |
|
Back to top | |
scenarioTypeChanged When a user changes a competitive scenario to an alternative scenario in an opportunity. |
|
scenarioDescriptionChanged When a user adds or updates the description for a scenario in an opportunity. |
|
loanRecalulated When a user updates loan information in an opportunity, including adding a loan product, to recalculate the financials. |
|
log-engine-change When a user updates loan information in an opportunity, including adding a loan product, to recalculate the financials. |
|
loanAdded When a loan product is added to an opportunity. |
|
Back to top | |
commercial-loan-account-created When a commercial loan product is added to an opportunity. |
|
loanRemoved When a loan product is removed from an opportunity. |
|
loanNameChanged When a user changes the name of a product on the product tab in an opportunity. |
|
conversionLoanAdded When a user adds the permanent loan to a loan product enabled for conversion |
|
conversionLoanRemoved When a user removes the permanent loan from a loan product enabled for conversion |
|
Back to top | |
depositRecalculated When a user updates deposit information in an opportunity, including adding a deposit product, to recalculate the financials. |
|
log-engine-change-deposit When a user updates deposit information in an opportunity, including adding a deposit product, to recalculate the financials. |
|
depositAdded When a user adds a deposit product to an opportunity |
|
depositRemoved When a user removes a deposit product from an opportunity |
|
otherRecalculated When a user updates information for an other product in an opportunity, including adding an other product, to recalculate the financials. |
|
log-engine-change-other When a user updates information for an other product in an opportunity, including adding an other product, to recalculate the financials. |
|
otherAdded When a user adds an other product to an opportunity. |
|
otherRemoved When a user removes an other product from an opportunity. |
|
Back to top | |
andi-in-app-action is-helpful-yes When a user selects 'Yes' to "Does this answer your question?" in the Andi® Window. |
no applicationEventData |
andi-in-app-action is-helpful-no When a user selects 'No' to "Does this answer your question?" in the Andi® Window. |
no applicationEventData |
andi-in-app-action contact-me-learning-no When a user selects 'No' to "I'm sorry, would you like someone to contact you?" in the Andi® Window. |
no applicationEventData |
andi-in-app-action contact-me-learning-yes When a user selects 'Yes' to "I'm sorry, would you like someone to contact you?" in the Andi® Window, which sends an email to Precisionlender Support. |
no applicationEventData |
Back to top |