ILoan
Methods & Events for interacting with an open loan in the application
See LoanEvents for supported events
Extends
Methods
_dispose()?
optional _dispose(): void;
Returns
void
Inherited from
_toJSON()
_toJSON(): RemotingScriptingObject;
Returns
Inherited from
all()
all(): Promise<LoanObject>;
Get complete Loan object
Returns
Promise<LoanObject>
v3 Loan Object
Example
const loanData = await loan.all();
applyLock()
applyLock(fieldId: string, lock: boolean): Promise<void>;
Applies or removes the calculation lock on a loan field.
In this way you can enable or disable the lock on a loan field programmatically.
Parameters are: ID of the field you want to apply or remove the calculation lock and the status you want to set the lock to
Parameters
fieldId
string
ID of the field you want to apply or remove the calculation lock
lock
boolean
status you want to set the lock to
Returns
Promise<void>
Example
await loan.applyLock('4001', true);
calculate()
calculate(): Promise<LoanObject>;
Executes calculations and business rules
Returns
Promise<LoanObject>
updated loan object
Example
await loan.calculate();
commit()
commit(): Promise<string>;
Commit all pending changes on the current loan
Fires the loan.precommit event before committing the changes
Fires the loan.committed event after committing the changes
Business rule violations will prevent the loan from being committed
Returns
Promise<string>
loan id
Example
await loan.commit();
execAction()
execAction(type: LoanLevelActions, params?: Record<string, unknown>): Promise<ActionResponse>;
Execute loan level action, this is specific to v3 stateful implementation
Invokes state API with all pending changes in current change-set along with requested loan action
Fires the loan.sync event after the action is executed
Parameters
type
type of action to be executed. e.g. updateCorrespondentBalance
params?
Record<string, unknown>
additional parameters for the action
Returns
Promise<ActionResponse>
updated loan object
Example
await loan.execAction('calculateEEMMortgage');
getCollection()
getCollection(name: LoanCollection): Promise<LoanCollectionObject>;
Returns an object reference of type LoanCollection.
Argument "name" is required & used to get specific collection like BorrowerEmployer, Escrow etc.
Parameters
name
collection template name
Returns
Promise<LoanCollectionObject>
collection object
Throws
error if collection name is invalid
Example
const borrowerEmployer = await loan.getCollection('BorrowerEmployer');
getCurrentApplication()
getCurrentApplication(): Promise<ApplicationInfo>;
Get the current borrower pair information
Returns
Promise<ApplicationInfo>
borrower pair information
Example
const currentApplication = await loan.getCurrentApplication();
getField()
getField(id: string): Promise<string>;
get value of the standard or custom field
Parameters
id
string
field id
Returns
Promise<string>
field value. Default or blank value is returned if the field is not set
Throws
error if field id is empty, null or undefined
Examples
const fieldValue = await loan.getField('4001');
const fieldValue = await loan.getField('URLA.X1');
getFieldOptions()
getFieldOptions(param: FieldOptionsParam): Promise<Record<string, FieldOptions[]>>;
get options for loan fields / custom form controls
supports both standard & custom loan fields.
control Ids takes precedence over field Ids.
Parameters
param
parameter for getting field options
Returns
Promise<Record<string, FieldOptions[]>>
array of field options for each field / control id
Example
const fieldOptions = await loan.getFieldOptions({ fieldIds: ['1543', '1544'] });
const fieldOptions = await loan.getFieldOptions({ controlIds: ['111', '112'] });
Following is a sample field options for field Id 1543:
1543: [
{
value: 'Manual Underwriting',
name: 'Manual Underwriting'
},
{
value: 'DU',
name: 'DU'
},
{
value: 'LP',
name: 'LP'
},
{
value: 'LQA',
name: 'LQA'
},
{
value: 'Other',
name: 'Other'
}
]
getFields()
getFields(ids: string[]): Promise<Record<string, string>>;
Returns the value of a standard or custom fields
Default or blank value is returned if the field is not set
Parameters
ids
string[]
The field Ids to get the value of
Returns
Promise<Record<string, string>>
The field values
Example
const fieldValues = await loan.getFields(['4001', '4002']);
isReadOnly()
isReadOnly(): Promise<boolean>;
Indicates if the loan is editable or in a read-only state.
Returns
Promise<boolean>
merge()
merge(): Promise<void>;
Syncs the loan workspace with any changes made by other users.
Returns
Promise<void>
Example
await loan.merge();
setCurrentApplication()
setCurrentApplication(options: CurrentApplicationOptions): Promise<void>;
Switch borrower pair
Fires the loan.applicationselected event after the borrower pair is switched
Parameters
options
borrower pair information
Returns
Promise<void>
Throws
error if borrower pair infromation is invalid
Example
await loan.setCurrentApplication({
id: '5D3B4A1B-3D3B-4A1B-5D3B-4A1B3D3B4A1B'
});
setEditMode()
setEditMode(options: EditModeOptions): Promise<void>;
Set UI edit mode for the loan.
It doesn't apply loan level lock.
Use this api to prevent current user from making edits to the loan file, while a compliance based workflow is in progress
Parameters
options
options for setting edit mode
Returns
Promise<void>
Example
await loan.setEditMode({mode: 'READONLY', moduleId: 'urn:encompass:efolder'});
setFields()
setFields(fields: Record<string, string>): Promise<void>;
Set the values of one or more standard or custom fields
Throws an error if non-existing field id is passed. Fields following the non-existing field will not be set.
Fires the loan.change event for each field that is changed and loan.sync event after all fields are set
Parameters
fields
Record<string, string>
list of field ids and their values
Returns
Promise<void>
Example
await loan.setField({'4000': 'John', '4002': 'David'});
Properties
ApplicationSelected
readonly ApplicationSelected: IEvent;
event fired when the loan application is selected
Use LoanApplicationSelectedListener to handle this event
Examples
with v2 SSF
guest.subscribe({
eventId: 'loan.applicationselected',
callback: ({ eventParams }) => {
console.log('Application Selected', eventParams);
});
});
with v1 SSF
elli.script.subscribe('loan', 'applicationselected', ({ eventParams }) => {
console.log('Application Selected', eventParams);
});
Change
readonly Change: IEvent;
event fired for each loan change made by the user
Use LoanChangeListener to handle this event
Examples
with v2 SSF
guest.subscribe({
eventId: 'loan.change',
callback: ({ eventParams }) => {
console.log('Loan changed', eventParams);
});
criteria: {
fieldId: { eq: 4000 }
}
});
with v1 SSF
elli.script.subscribe('loan', 'change', ({ eventParams }) => {
console.log('Loan changed', eventParams);
});
Close
readonly Close: IEvent;
event fired prior to closing the loan
Use LoanCloseListener to handle this event
Examples
with v2 SSF
guest.subscribe({
eventId: 'loan.close',
callback: ({ eventParams }) => {
console.log('Loan closing', eventParams);
return true;
});
});
with v1 SSF
elli.script.subscribe('loan', 'close', ({ eventParams }) => {
console.log('Loan closing', eventParams);
return true;
});
Committed
readonly Committed: IEvent;
event fired when the loan changes are committed
Use LoanCommittedListener to handle this event
Examples
with v2 SSF
guest.subscribe({
eventId: 'loan.committed',
callback: ({ eventParams }) => {
console.log('Loan committed', eventParams);
});
});
with v1 SSF
elli.script.subscribe('loan', 'committed', ({ eventParams }) => {
console.log('Loan committed', eventParams);
});
EditModeChange
readonly EditModeChange: IEvent;
event fired when the loan edit mode is changed
Use LoanEditModeChangeListener to handle this event
Examples
with v2 SSF
guest.subscribe({
eventId: 'loan.editModeChange',
callback: ({ eventParams }) => {
console.log('Loan edit mode changed', eventParams);
});
});
with v1 SSF
elli.script.subscribe('loan', 'editModeChange', ({ eventParams }) => {
console.log('Loan edit mode changed', eventParams);
});
ExternallyModified
readonly ExternallyModified: IEvent;
event fired when the loan is modified outside the current user interface, such as by automation, another user, or developer connect.
This event does not include information about what changed.
Use LoanExternallyModifiedListener to handle this event
Examples
with v2 SSF
guest.subscribe({
eventId: 'loan.externallyModified',
callback: () => {
console.log('Loan modified externally');
});
});
with v1 SSF
elli.script.subscribe('loan', 'externallyModified', () => {
console.log('Loan modified externally');
});
FieldChangeSync
readonly FieldChangeSync: IEvent;
event fired when a loan field is changed return true to further process the field change, false to cancel the field change
Use LoanFieldChangeSyncListener to handle this event
Examples
with v2 SSF
guest.subscribe({
eventId: 'loan.fieldChangeSync',
callback: ({ eventParams }) => {
console.log('Loan field changed', eventParams);
return true;
});
criteria: {
fieldId: { eq: 4000 }
}
});
with v1 SSF
elli.script.subscribe('loan', 'fieldChangeSync', ({ eventParams }) => {
console.log('Loan field changed', eventParams);
return true;
});
id
readonly id: string;
Inherited from
MilestoneCompleted
readonly MilestoneCompleted: IEvent;
event fired when the loan milestone is completed
Use LoanMilestoneCompletedListener to handle this event
Examples
with v2 SSF
guest.subscribe({
eventId: 'loan.milestoneCompleted',
callback: ({ eventParams }) => {
console.log('Loan milestone completed', eventParams);
});
});
with v1 SSF
elli.script.subscribe('loan', 'milestoneCompleted', ({ eventParams }) => {
console.log('Loan milestone completed', eventParams);
});
objectType
readonly objectType: string;
Inherited from
Open
readonly Open: IEvent;
event fired when the loan is opened
Use LoanOpenListener to handle this event
Examples
with v2 SSF
guest.subscribe({
eventId: 'loan.open',
callback: ({ eventParams }) => {
console.log('Loan open', eventParams);
});
});
with v1 SSF
elli.script.subscribe('loan', 'open', ({ eventParams }) => {
console.log('Loan open', eventParams);
});
PreCommit
readonly PreCommit: IEvent;
event is fired prior to saving and pending changes to the loan
One can use this event to perform custom validation and, via the feedback mechanism, prevent the loan from being saved.
Use LoanPreCommitListener handles this event
Examples
with v2 SSF
guest.subscribe({
eventId: 'loan.precommit',
callback: ({ eventParams }) => {
console.log('Loan precommit', eventParams);
return true;
});
});
with v1 SSF
elli.script.subscribe('loan', 'precommit', ({ eventParams }) => {
console.log('Loan precommit', eventParams);
return true;
});
PreMilestoneComplete
readonly PreMilestoneComplete: IEvent;
event is fired when the user attempts to complete a milestone and allows for custom validation, and cancellation, of the process.
Use LoanPreMilestoneCompleteListener to handle this event
Examples
with v2 SSF
guest.subscribe({
eventId: 'loan.premilestonecomplete',
callback: ({ eventParams }) => {
console.log('Loan pre-milestone complete', eventParams);
return true;
});
});
with v1 SSF
elli.script.subscribe('loan', 'premilestonecomplete', ({ eventParams }) => {
console.log('Loan pre-milestone complete', eventParams);
return true;
});
Sync
readonly Sync: IEvent;
event fired when the loan is synced with any changes made by other users or external systems
Use LoanSyncListener to handle this event
Examples
with v2 SSF
guest.subscribe({
eventId: 'loan.sync',
callback: ({ eventParams }) => {
console.log('Loan synced', eventParams);
});
});
with v1 SSF
elli.script.subscribe('loan', 'sync', ({ eventParams }) => {
console.log('Loan synced', eventParams);
});