When pricing an opportunity in PrecisionLender, application events are sent to Andi® to notify her of changes to the opportunity. The get account powers target the engineModel (financial data) of the Opportunity Model that can be used as the result of a change event in the Opportunity Context.


In this Article


What are the get account powers?

The get account powers are an array that when called, will make the financial data from the engineModel for products in the opportunity accessible via intellisense that can be used when writing your skill code.

The available get account powers are:

  • getLoanAccounts - allows access to the specific array for commercial loan account data, including the financial statement, from the engineModel when an opportunityChangeEvent occurs
  • getDepositAccounts - allows access to the specific array for deposit account data, including the financial statement, from the engineModel when an opportunityChangeEvent occurs
  • getOtherFeesAccounts - allows access to the specific array for other accounts data, including the financial statement, from the engineModel when an opportunityChangeEvent occurs
  • getOpportunityChangeEventData - allows access to the full array of engineModel data for all accounts in an opportunity when an opportunityChangeEvent occurs.


When to use the get account powers

You should use the get account powers when needing to obtain account data when a change event occurs that will be used to determine whether a skill runs or what happens when the skill runs, without having to specify (or remember) areas of the engineModel.

For example, if you want a skill to run based on the presence of commercial loans being priced, you could use the getOpportunityChangeEventData power or getLoanAccounts power to obtain the data. 


How to call the get account powers

The get account powers will be called via the opportunity property of the PrecisionLender powers.

let yourVariableName = skillContext.powers.precisionLender.opportunity.getAccount()

To access the array of data within the engineModel, you will then need to cast the variable you defined with the power to the PrecisionLenderOpportunityChangeEvent property of andiExternal. 

let theData = yourVariableName as andiExternal.PrecisionLenderOpportunityChangeEvent.selectedArrayOrClass

Using intellisense, you will then be able to select the corresponding array dependent upon the power selected. After you cast your variable, you will then be able to use intellisense to access the full array of data from the engineModel.

For these powers, your selection will align with the following:

getLoanAccounts -> CommercialLoanAccount

let getLoanAccountData = skillContext.powers.precisionLender.opportunity.getLoanAccounts();

let loanAccountData = getLoanAccountData as andiExternal.PrecisionLenderOpportunityChangeEvent.CommercialLoanAccount[];

//you can now access the commercialLoanAccount array via intellisense when defining a variable
let loanAmount = loanAccountData[0].amount > 1000000;

getDepositAccounts -> DepositAccount

let getDepositAccountData = skillContext.powers.precisionLender.opportunity.getDepositAccounts();

let depositAccountData = getDepositAccountData as andiExternal.PrecisionLenderOpportunityChangeEvent.DepositAccount[]; //you can now access the depositAccount array via intellisense when defining a variable let depositBalance = depositAccountData[0].averageBalance = 0; 

getOtherFeesAccounts -> OtherFeesAccount

let getOtherAccountData = skillContext.powers.precisionLender.opportunity.getOtherFeesAccounts();

let otherAccountData = getOtherAccountData as andiExternal.PrecisionLenderOpportunityChangeEvent.OtherFeesAccount[]; //you can now access the otherFeesAccount array via intellisense let otherFeeIncome = otherAccountData[0].financialStatement.otherIncome < 10000; 

getOpportunityChangeEventData -> OpportunityChangeEvent

let eventData = skillContext.powers.precisionLender.opportunity.getOpportunityChangeEventData();

let opportunityData = eventData as andiExternal.PrecisionLenderOpportunityChangeEvent.OpportunityChangeEvent; let hasLoan = opportunityData.engineModel && opportunityData.engineModel.commercialLoanAccounts[0] && opportunityData.engineModel.commercialLoanAccounts[0].initialRate > .06

Here's an example shouldIRun using our earlier example of running a skill based on the presence of commercial loans being priced using the getOpportunityChangeEventData power

let isOpportunityChange = skillContext.powers.precisionLender.opportunity.isOpportunityChangeEvent();

if (!isOpportunityChange)
return skillContext.powers.andi.ShouldIRun.shouldIRunFalse();

//Using getOpportunityChangeEventData(); as an example

let eventData = skillContext.powers.precisionLender.opportunity.getOpportunityChangeEventData();

// if opportunityData is available check for any other conditions

if(eventData) {

let opportunityData = eventData as andiExternal.PrecisionLenderOpportunityChangeEvent.OpportunityChangeEvent[];

let hasLoan = opportunityData.engineModel

&& opportunityData.engineModel.commercialLoanAccounts

&& opportunityData.engineModel.commercialLoanAccounts.length > 0;

// if the opportunity doesn't have loan, don't run




return skillContext.powers.andi.shouldIRun.shouldIRunTrue();
Was this article helpful?
0 out of 0 found this helpful