PrecisionLender Opportunity Page API Reference

Overview

This article contains a list of available client-side page API methods that can be used when using the shouldIShow and action functions of the Field Tag power.

 

In this Article

 

Page (Global)

To call the method, you'll enter

api.page.yourDesiredMethod

//Example
api.page.getCurrentUser()

 

Global Methods

/* returns the current date as an ISO String 
("YYYY-MM-DDTHH:mm:ss.sss")*/
getCurrentDate() 
getCurrentPage()
getCurrentUser()
isCurrentUserIn(ids)
openEmail(to, subject, body, cc)
openNewTab(url)
openScenarioPopup()
refreshCurrentPage()
save()
setPricingDate('YYYY-MM-DD')

 

Opportunity

To call the method, you'll enter

api.opportunity.yourDesiredMethod

//Example api.opportunity.getStage()

 

Opportunity Getters
createCopyScenario(scenario)

/* returns the projected close date of an opportunity as a string ("M/DD/YYYY")*/ getCloseDate()
getCurrentScenario() getFinancialStatement() getId() getName() getOwner()
/*returns the pricing date of an opportunity as a momentJs object*/ getPricingDate()
getPricingRegionId()
/*will return null if a relationship isn't attached to an opportunity*/
getRelationshipAPI ()
getRelationshipId() getStage() getAvailableStages() getCurrentAssumptionSetId()
Raw Opportunity Getters
raw.getCloseDate() 
      
/*returns the projected close date of an opportunity as 
a momentJs object*/
raw.getPricingDate()

 

Raw Opportunity Getter Example

//Example run.ts using _d.toString() to convert raw.getCloseDate() to the same format
//as the closeDate (custom.closeDate) from the opportunity model for date comparison

export async function run(skillContext: andiSkills.ISkillContext) : Promise { const event: andiSkills.IApplicationEvent = skillContext.event as andiSkills.IApplicationEvent; const data = event.applicationEventData; const cla: CommercialLoanAccount = data.engineModel.commercialLoanAccounts.find((cla) => { return cla.id === data.contextId; }); const opportunityModel: andiSkills.PrecisionLender.Opportunity.OpportunityModel = await skillContext.powers.precisionLender.opportunity.getCurrentOpportunityModel(); let maturityMonths: number = cla.maturity;

//here we define closeDate, which in addition to being a parameter for the message variable
//for the fieldTag power, will also be passed as a custom variable in the fieldTag power
//for use in the shouldIShow
let closeDate: Date = new Date(opportunityModel.opportunityDetails.closeDate); closeDate.setUTCMonth(closeDate.getUTCMonth() + maturityMonths); let message = `Matures on ${getDateString(closeDate)}` return skillContext.powers.andi.fieldTag.sendFieldTag(andiSkills.FieldTagTypes.Info, "Matures-On-Notification", -1, message, ["maturity", "disableforandibutton"], null, shouldIShow, null, null, { closeDate: opportunityModel.opportunityDetails.closeDate, maturity: maturityMonths }, null); }
//for readability, the shouldIShow function of the fieldTag power is being defined
//separately
function shouldIShow(api, model, compareHash, custom) : boolean { var loanId = model.currentContext; var currentScenarioId = ""; Object.keys(api.scenarios).forEach(function(scenarioId) { Object.keys(api.scenarios[scenarioId].commercialLoanAccounts).forEach(function(commercialLoanAccountId) { const commercialLoanAccount = api.scenarios[scenarioId].commercialLoanAccounts[commercialLoanAccountId]; if(commercialLoanAccount.commercialLoanAccount.getId() === loanId) { currentScenarioId = scenarioId; } }); }); var currentLoanAccountAPI = api.scenarios[currentScenarioId].commercialLoanAccounts[loanId].commercialLoanAccount;
//here raw.getCloseDate is converted to a date string comparable with closeDate
//which was previously defined above and is now being passed in as a custom variable
if (new Date(api.opportunity.raw.getCloseDate()._d.toString()).getTime() != new Date(custom.closeDate).getTime()) return false; if (parseInt(currentLoanAccountAPI.getMaturity()) != custom.maturity) return false; return true; } //for readability, the getDateString function of the message variable is being defined
//separately

function getDateString(date: Date): string { var monthNames = [ "Jan", "Feb", "Mar", "Apr", "May", "June", "July", "Aug", "Sep", "Oct", "Nov", "Dec" ]; return `${date.getUTCDate()} ${monthNames[date.getUTCMonth()]} ${date.getFullYear()}`; }

 

Opportunity Setters

setStage()
setCurrentScenario()
setPipelineScenario()
setCloseDate()

 

Scenarios

To call the method, you'll enter

api.scenarios.yourDesiredMethod

//Example
api.scenarios.scenario[0].getScenarioType()

 

Scenario Methods

accessEngine() //returns the engine object
commercialLoanAccounts[CLA_ID]
depositAccounts[DEPOSIT_ID]
scenario [SCENARIO_ID]{
getClientId(),
getCompetitorName(),
getDescription(),
getEnabledDepositProducts(),
getFinancialStatement(),
getId(),
getLoanAPIs(),
getName(),
getScenarioType(),
isPipelineScenario(),
readyConversionLoans(),
setEnabledDepositProducts(depositProducts)
}

 

Scenario Actions

readyConversionLoans()
addCommercialLoanAccount()
addDepositAccount()
addOtherAccount()

 

Scenario methods for commercialLoanAccounts

commercialLoanAccount Raw GettersReturns the raw data

raw.getAmount: function () { 
return self.dto.amount();
}

raw.getInitialRate: function () {
return self.dto.initialRate();
}

raw.getMaturity: function () {
return self.dto.maturity();
}

raw.getAmortizationTerm: function () {
return self.dto.amortizationTerm();
}

raw.getAdjustableRateIndexRate: function () {
return self.dto.adjustableRateIndexRate();
}

raw.getAdjustableRateSpread: function () {
return self.dto.adjustableRateSpread();
}

raw.getFeesInitialPercentOfAmount: function () {
return self.dto.feesInitialPercentOfAmount();
}

raw.getFeesInitialDollars: function () {
return self.dto.feesInitialDollars();
}

raw.getFeesAnnualDollars: function () {
return self.dto.feesAnnualDollars();
}

raw.getFeesUnusedLOC: function () {
return self.dto.feesUnusedLOC();
}

raw.getFeesNotTaxExemptInitialDollars: function () {
return self.dto.feesNotTaxExemptInitialDollars();
}

raw.getFeesNotTaxExemptInitialPercentOfAmount: function () {
return self.dto.feesNotTaxExemptInitialPercentOfAmount();
}

raw.getSwapFees: function () {
return self.dto.calculated.swaps.swapFee();
}

raw.getSwapSpread: function () {
return self.dto.calculated.swaps.swapFixedSpread();
}

raw.getSwapIndicativeFixedRate: function () {
return self.dto.calculated.swaps.indicativeFixedRate();
}

raw.getLOCAverageUsagePercent: function () {
return self.dto.locAverageUsagePercent();
}

raw.getFundingPackageId: function () {
return self.dto.fundingPackageId();
}

raw.getHasDraws: function () {
return self.dto.draws().length > 0;
}

 

Non-raw functions - Returns formatted data or data object

commercialLoanAccount Getters

getId: function () { 
	return self.id.id; 
},

getClientId: function () { 
	return self.id.rawClientId; 
},

getFullId: function () { 
	return self.id; 
},

getAmount: function () { 
	return self.amount(); 
},

getInitialRate: function () { 
	return self.initialRate(); 
},

getMaturity: function () { 
	return self.maturity(); 
},

getAmortizationTerm: function () { 
	return self.amortizationTerm(); 
},

getAdjustableRateIndexRate: function () { 
	return self.adjustableRateIndexRate(); 
},

getAdjustableRateSpread: function () { 
	return self.adjustableRateSpread(); 
},

getMaximumInitialAdjustment: function () {
return self.dto.maximumInitialAdjustment();
},

getMaximumPeriodicAdjustment: function () {
return self.dto.maximumPeriodicAdjustment();
},

getMaximumLifetimeAdjustment: function () {
return self.dto.maximumLifetimeAdjustment();
},

getFirstPaymentMonth: function () {
return self.firstPaymentMonth();
}, getFeesInitialPercentOfAmount: function () { return self.feesInitialPercentOfAmount(); }, getFeesInitialDollars: function () { return self.feesInitialDollars(); }, getFeesAnnualDollars: function () { return self.feesAnnualDollars(); }, getFeesUnusedLOC: function () { return self.feesUnusedLOC(); }, getFeesNotTaxExemptInitialDollars: function () { return self.feesNotTaxExemptInitialDollars(); }, getFeesNotTaxExemptInitialPercentOfAmount: function () { return self.feesNotTaxExemptInitialPercentOfAmount(); }, getSwapFees: function () { return self.swaps.swapFee(); }, getSwapSpread: function () { return self.swaps.swapFixedSpread(); }, getSwapIndicativeFixedRate: function () { return self.swaps.swapIndicativeFixedRate(); }, getProduct: function () { return ko.toJS(self.product()); }, getProductFamilyId: function () { return self.product().productFamilyId.id; }, getAllowableConversionProductFamilyIds: function () { return self.product().conversionCommercialLoanProductFamilyIds; }, getRiskRating: function () { return ko.toJS(self.riskRating()); }, getPaymentType: function () { return self.paymentType(); }, getPaymentFrequency: function () { return self.paymentFrequency(); }, getInterestRateCalculation: function () { return self.interestRateCalculation(); }, getTaxExemptionOption: function () { return self.taxExemptionOption(); }, getRateType: function () { return self.rateType(); }, getIndexRateName: function () { return self.dto.calculated.adjustableRateIndexName(); }, getCaps: function () { return ko.toJS(self.capsAndFloors); }, getCollateralPositions: function () { return ko.toJS(self.collateralPositions); }, getOriginationChannel: function () { return self.originationChannel(); }, getServicingChannel: function () { return self.servicingChannel(); }, getPrepaymentOption: function () { return self.prepaymentOption(); }, getFinancialStatement: function () { return ko.toJS(self.financialStatement); }, getIsFixedRateLocked: function () { return self.isFixedRateLocked(); }, getIsSpreadLocked: function () { return self.isSpreadLocked(); }, getAmountValue: function () { return self.amount.rawValue(); }, getIsConvertible: function () { return self.conversionLoanRelated.conversionLoanProducts().length >= 1; }, getConversionLoanAPI: function () { if (self.conversionLoanRelated.conversionLoan()) return self.conversionLoanRelated.conversionLoan().commercialLoanAccountAPI; else return null; }, getPrimaryLoanAPI: function () { if (self.conversionLoanRelated.primaryLoan()) return self.conversionLoanRelated.primaryLoan().commercialLoanAccountAPI; else return null; }, getDrawModelFromValues: function (drawMonth, drawAmount) { return DrawModel.GetFromMonthAndAmount(drawMonth, drawAmount, self.getNewIdentity, self.amount, moneyInputType); }, getCustomerAmortizationWithProposedDrawSchedule: function (recommendedSchedule) { return self.manager.getCustomerAmortizationWithProposedDrawSchedule(recommendedSchedule); }, getAvailableFundingPackages: function () { return self.availableFundingPackages(); }, getAmortizationDistance: function (proposedAmortization) { var i; if (!proposedAmortization || proposedAmortization.entries.length === 0) { return 0; } var currentAmortization = self.manager.customerAmortization();//.entries[month].contractual.beginningBalance; var diff = 0; for (i = 0; i < proposedAmortization.entries.length; i++) { var drawnAmount = currentAmortization.entries[i].contractual.endingBalance; var proposedDrawnAmount = proposedAmortization.entries[i].contractual.endingBalance; diff += Math.abs(drawnAmount - proposedDrawnAmount); } var percentDiff = diff / self.dto.amount(); var avgPercentDiff = percentDiff / proposedAmortization.entries.length; return avgPercentDiff; }, getLatestDrawSchedulePredictionInput: function () { return self.latestDrawSchedulePredictionInput; }, getLatestDrawSchedulePredictionResult: function (inputVector) { return self.latestDrawSchedulePredictionResults[inputVector]; }, getScheduledCommitments: function () { return self.scheduledCommitments(); }

 

commercialLoanAccount Getters Example

//Example code for obtaining the payment type of a commercial loan in a scenario
var currentScenario;
model.currentlyViewedContext.forEach((ctx)=>{
if(ctx.name==="scenario")
currentScenario = ctx.id;
});

var currentLoanAPI = api.scenarios[currentScenario].commercialLoanAccounts[model.applicationEventData.contextId];

var paymentType = currentLoanAPI.commercialLoanAccount.getPaymentType();
console.log(paymentType);
if(paymentType.value===4)
return true; //Example of obtaining the ROE for the current scenarios and formatting the ROE value let scenId = model.currentlyViewedContext[1].id; /*if (scenId != custom.scenId) return false; */
let fs = api.scenarios[scenId].scenario.getFinancialStatement(); // "valueOf()" returns a string with a %-sign and possibly with parentheses (if it's a negagive number) let roe = fs.ROE.valueOf().trim(); // remove leading & trailing blanks if (roe.indexOf('(') >=0 ) roe = roe.replace("(","-"); // replace open-parentheses with a negative sign if (roe.indexOf(')') >=0 ) roe = roe.replace(')',''); // remove close-parentheses if (roe.indexOf('%') >=0 ) roe = roe.replace('%','')/100.0; // drop the %-sign and divide by 100

Back to Scenario Methods

 

 

commercialLoanAccount Setters

The raw value will need to be provided

setLatestDrawSchedulePredictionInput: function (value) {
	self.latestDrawSchedulePredictionInput = value;
},

setLatestDrawSchedulePredictionResult: function (inputVector, value) {
	self.latestDrawSchedulePredictionResults[inputVector] = value;
},

setInitialFeesPercentOfAmount: function (amount) {
	self.dto.feesInitialPercentOfAmount(amount);
},

setAdjustableRateSpread: function (amount) {
	self.dto.adjustableRateSpread(amount);
},

setInitialRate: function (rate) {
	self.dto.initialRate(rate);
},

setInterestRateCalculation: function (value) {
			var interestRateToUse = interestRateCalculationTypesEnum[value];
			if (_.contains(self.product().allowableInterestRateCalculationsList, interestRateToUse)) {
				self.dto.interestRateCalculation(interestRateToUse.value);
			}
			else {
				var helperFunctions = scenarioAPI.page.helper;
				if (!helperFunctions.isString(value))
					return;

				value = helperFunctions.createEasierStringMatch(value);
				interestRateToUse = _.find(interestRateCalculationTypesEnum.itemArray, function (pf) {
					return helperFunctions.createEasierStringMatch(pf.description) === value;
				});
				if (_.contains(self.product().allowableInterestRateCalculationsList, interestRateToUse)) {
					self.dto.interestRateCalculation(interestRateToUse.value);
				}
			}
},

setMaturity: function (maturity) {
	self.dto.maturity(maturity);
},

setExpenseServicingDollars: function (yearlyExpenseServicingDollars) {
	var expenseServicingDollars = yearlyExpenseServicingDollars / 12.0;
	self.dto.expenseServicingDollars(expenseServicingDollars);
},

setLOCAverageUsagePercent: function (newUsagePercent) {
	self.dto.locAverageUsagePercent(newUsagePercent);
},

setPrimaryLoanId: function (primaryLoanId) {
	self.dto.primaryLoanId(primaryLoanId);
},

setDrawSchedule: function (response) {
	var previousValue = 0.0;
	var recommendedCount = 0;
	var drawList = response;

	var i;
	var recommendedSchedule = [];

	for (i = 0; i < drawList.length; i++) {
		if (Number(drawList[i]) > Number(previousValue)) {
			var drawPercent = (drawList[i] - previousValue) / 100.0;
			var drawAmount = drawPercent * self.dto.amount();
			var drawMonth = i;

			previousValue = drawList[i];
			recommendedSchedule[recommendedCount] = DrawModel.GetFromMonthAndAmount(drawMonth, drawAmount, self.getNewIdentity, self.amount, moneyInputType);
			recommendedCount++;
		}
 }

	self.andiDrawsSuggestion(null);
	self.andiDrawsSuggestionCustomerAmortization(null);
	self.draws(recommendedSchedule);
},

setAndiDrawScheduleSuggestion: function (drawSchedulePrediction) {
	self.andiDrawsSuggestion(drawSchedulePrediction);
},

setAndiDrawScheduleSuggestionAmortization: function (proposedScheduleAmortization) {
	self.andiDrawsSuggestionCustomerAmortization(proposedScheduleAmortization);
},

setAmount: function (value) {
	self.dto.amount(value);
},

setLOCInitialBalance: function (value) {
	self.dto.locInitialBalance(value);
},

setFixedRateSpread: function (value) {
	self.dto.fixedRateSpread(value);
},

setRateType: function (value) {                            
	if (_.find(self.allowableRateTypes(), function (art) { return art.value === value; }))
		self.dto.rateType(value);
},

setPaymentType: function (value) {
	if(_.find(self.product().allowablePaymentTypesList, function (pt) { return pt.value === value; }))
		self.dto.paymentType(value);
},

setLetterOfCreditType: function (value) {
	if (_.find(self.allowableLetterOfCreditTypes(), function (lct) { return lct.value === value; }))
		self.dto.letterOfCreditType(value);
},

setPaymentFrequency: function (value) {
    var paymentFrequencyToUse = paymentFrequencyTypesEnum[value];
	  if (paymentFrequencyToUse) {
				self.dto.paymentFrequency(paymentFrequencyToUse.value);
		}
		else {
				 var helperFunctions = scenarioAPI.page.helper;
				 if (!helperFunctions.isString(value))
				   return;

				 value = helperFunctions.createEasierStringMatch(value);
				 paymentFrequencyToUse = _.find(paymentFrequencyTypesEnum.itemArray, function (pf) {
					 return helperFunctions.createEasierStringMatch(pf.description) === value;
				 });
		if (paymentFrequencyToUse)
				self.dto.paymentFrequency(paymentFrequencyToUse.value);
		}
},

setAdjustableRateAdjustmentFrequency: function(value){
	self.dto.adjustableRateAdjustmentFrequency(value);
},

setAdjustableRateInitialPeriod: function(value){
	self.dto.adjustableRateInitialPeriod(value);
},

setAdjustableRateIndexFamily:function(value){
	var newIndexFamily = _.find(self.displayableIndexFamiliesList(), function (difl) { return difl.description === value; });
	if (newIndexFamily)
	self.selectedIndexFamily(newIndexFamily);
},

setAdjustableRateIndexDuration:function(value){
	var indexRateModel = _.find(self.indicesAttachedToSelectedFamily(), function (iatf) { return iatf.index.duration === value; });
	if (indexRateModel)
	self.selectedIndexForFamily(indexRateModel);
},

setAmortizationTerm:function(value){
	self.dto.amortizationTerm(value);
},

setFeesInitialDollars:function(value){
	self.dto.feesInitialDollars(value);
},

setFeesAnnualDollars:function(value){
	self.dto.feesAnnualDollars(value);
},

setFeesUnusedLOC:function(value){
	self.dto.feesUnusedLOC(value);
},

setRiskRating:function(value){
	var riskRatingModel = _.find(self.availableRiskRatings(), function (arr) { return arr.rating === value || arr.id.id===value; });
	if (riskRatingModel)
	self.dto.riskRatingId(riskRatingModel.id);
},

setFundingSource:function(value){
	var fundingPackageModel = _.find(self.availableFundingPackages(), function (afp) { return afp.name === value || afp.id.id===value; });
	if (fundingPackageModel)
	self.dto.fundingPackageId(fundingPackageModel.id);
},

setOriginationChannel:function(value){
	var originationChannel = _.find(self.product().originationChannels.list, function (oc) { return oc.name === value || oc.id.id===value; });
	if (originationChannel)
	self.dto.originationChannelId(originationChannel.id);
},

setServicingChannel:function(value){
	var servicingChannel = _.find(self.product().servicingChannels.list, function (sc) { return sc.name === value || sc.id.id===value; });
	if (servicingChannel)
	self.dto.servicingChannelId(servicingChannel.id);
},

setExposureType:function(value){
	var exposureType = _.find(self.allowableExposureTypes(), function (sc) { return sc.key === value || sc.value===value; });
	if (exposureType)
		self.dto.exposureType(exposureType.value);
},

setAssetCategory:function(value){
	var assetCategory = _.find(self.dto.assetCategories,function(ac){ return ac === value; });
	if(assetCategory)
		self.assetCategory = assetCategory;
},

setSwapForwardStartTerm:function(value){
	if(value===0)
		self.dto.calculated.swaps.forwardStartTerm(0);
	else{
		var term = _.find(self.swaps.forwardStartTerms(), function (fst) { return fst === value; });
		if (term)
			self.dto.calculated.swaps.forwardStartTerm(term);
	}
	
},

setSwapFixedRateSpread:function(value){
	self.dto.calculated.swaps.swapFixedSpread(value);
},

setSwapIndicativeFixedRate:function(value){
	self.dto.calculated.swaps.indicativeFixedRate(value);
},

setSwapFee:function(value){
	self.dto.calculated.swaps.swapFee(value);
},

setGuaranteedAmount:function(guaranteeId, value){
	var guarantee = _.find(self.guarantees(),function(g){return g.id.id===guaranteeId;});
	if(!guarantee)
		return;
	if(!guarantee.isTrackingLoanAmount())
		guarantee.dto.guaranteedAmount(value);
},

setGuaranteedPercent:function(guaranteeId, value){
	var guarantee = _.find(self.guarantees(),function(g){return g.id.id===guaranteeId;});
	if(!guarantee)
		return;
	if(guarantee.isTrackingLoanAmount())
		guarantee.dto.calculated.guaranteedPercent(value);
},

setGuaranteeRiskRating:function(guaranteeId, value){
	var riskRatingModel = _.find(self.availableRiskRatings(), function (arr) { return arr.rating === value || arr.id.id===value; });
	if (!riskRatingModel)
		return;
	
	var guarantee = _.find(self.guarantees(),function(g){return g.id.id===guaranteeId;});
	if(!guarantee)
		return;

	guarantee.dto.riskRatingId(riskRatingModel.id);
},

setCollateralCombinedLTV:function(collateralId, value){
	var collateral = _.find(self.collateralPositions(),function(cp){return cp.id.id===collateralId;});
	if(!collateral)
		return;
	if(collateral.isTrackingLoanAmount())
		collateral.dto.calculated.collateralLTV(value);
},

setCollateralValue:function(collateralId, value){
	var collateral = _.find(self.collateralPositions(),function(cp){return cp.id.id===collateralId;});
	if(!collateral)
		return;
	if(!collateral.isTrackingLoanAmount())
		collateral.dto.collateralValue(value);
},

setCollateralPriorLiens:function(collateralId, value){
	var collateral = _.find(self.collateralPositions(),function(cp){return cp.id.id===collateralId;});
	if(!collateral)
		return;
	collateral.dto.priorLiens(value);
},

setTaxExemptionOption: function (value) {
			var taxExemptionToUse = taxExemptionOptionTypesEnum[value];
			if (_.contains(self.product().allowableTaxExemptionOptionsList, taxExemptionToUse)) {
				self.dto.taxExemptionOption(taxExemptionToUse.value);
			}
			else {
				var helperFunctions = scenarioAPI.page.helper;
				if (!helperFunctions.isString(value))
					return;

				value = helperFunctions.createEasierStringMatch(value);
				taxExemptionToUse = _.find(taxExemptionOptionTypesEnum.itemArray, function (pf) {
					return helperFunctions.createEasierStringMatch(pf.description) === value;
				});
				if (_.contains(self.product().allowableTaxExemptionOptionsList, taxExemptionToUse)) {
					self.dto.taxExemptionOption(taxExemptionToUse.value);
				}
			}
},
		
setMaximumInitialAdjustment: function (value) {
			var helperFunctions = scenarioAPI.page.helper;
			if (!helperFunctions.isNumber(value) || !self.isRelevant.capsAndFloorsAdjustmentMaximums())
				return;
			value = Math.abs(value);
			self.dto.maximumInitialAdjustment(value);
},
		
setMaximumPeriodicAdjustment: function (value) {
			var helperFunctions = scenarioAPI.page.helper;
			if (!helperFunctions.isNumber(value) || !self.isRelevant.capsAndFloorsAdjustmentMaximums())
				return;
			value = Math.abs(value);
			self.dto.maximumPeriodicAdjustment(value);
},
		
setMaximumLifetimeAdjustment: function (value) {
			var helperFunctions = scenarioAPI.page.helper;
			if (!helperFunctions.isNumber(value) || !self.isRelevant.capsAndFloorsAdjustmentMaximums())
				return;
			value = Math.abs(value);
			self.dto.maximumLifetimeAdjustment(value);
},
		
setCapAndFloor: function (id, cap, floor, duration) {
			var helperFunctions = scenarioAPI.page.helper;
			if (!helperFunctions.isString(id) || !self.isRelevant.capsAndFloors())
				return;
			id = helperFunctions.createEasierStringMatch(id);
			var capAndFloor = _.find(self.capsAndFloors(), function (cf) {
				return helperFunctions.createEasierStringMatch(cf.id.id) === id;
			});
			if (!capAndFloor)
				return;

			if (floor && helperFunctions.isNumber(floor)) {
				floor = Math.abs(floor);
				if (!cap && floor <= capAndFloor.dto.cap() || floor <= cap)
					capAndFloor.dto.floor(floor);
			}
			if (cap && helperFunctions.isNumber(cap)) {
				cap = Math.abs(cap);
				if (!floor && cap >= capAndFloor.dto.floor() || cap >= floor)
					capAndFloor.dto.cap(cap);
			}
			if (duration && helperFunctions.isNumber(duration) && capAndFloor.endMonthOffset() !== null) {
				capAndFloor.dto.endMonthOffset(duration);
			}
},
		
setIsFirstPaymentMonthSpecified: function (value) {
			if (!self.isRelevant.firstPaymentMonth() || self.noneditableFirstPaymentMonthCheckbox())
				return;
			var helperFunctions = scenarioAPI.page.helper;
			if (!helperFunctions.isBoolean(value))
				return;
			self.dto.isFirstPaymentMonthSpecified(value);
		},
		setFirstPaymentMonth: function (value) {
			if (!self.isRelevant.firstPaymentMonth() || self.noneditableFirstPaymentMonth())
				return;
			var helperFunctions = scenarioAPI.page.helper;
			if (!helperFunctions.isNumber(value) || value === 0)
				return;
			value = Math.abs(value);
			self.dto.firstPaymentMonth(value);
}

 

commercialLoanAccount Setters Example

//Example code for setting the initial rate

var loanId = model.currentContext;
var currentScenarioId = "";
    Object.keys(api.scenarios).forEach(function(scenarioId) {
    Object.keys(api.scenarios[scenarioId].commercialLoanAccounts).forEach(function(commercialLoanAccountId) {
        const commercialLoanAccount = api.scenarios[scenarioId].commercialLoanAccounts[commercialLoanAccountId];

    if(commercialLoanAccount.commercialLoanAccount.getId() === loanId)
         {
            currentScenarioId = scenarioId;
          }
     });
  });

var currentLoanAccountAPI = api.scenarios[currentScenarioId].commercialLoanAccounts[loanId].commercialLoanAccount;

currentLoanAccountAPI.setInitialRate(0.05);

Back to Scenario Methods

 

commercialLoanAccount Actions

openDrawScheduleDialog()
addCollateral()
addGuarantee()
addScheduledCommitment()
addNewCapAndFloor()
clearAllCapsAndFloors()
removeCapAndFloor()

 

Scenario methods for depositAccounts

Deposit Getters

getProductFamilyId()

 

Deposit Actions

openDrawScheduleDialog()
addCollateral()

 

Scenario methods for Other Accounts

none

 

 

Was this article helpful?
0 out of 0 found this helpful