Published Objects Accessible to Child/Client Application
The following published objects are accessible to Child/Client application:
- tpoApplication
- auth
- loan
Methods Available in tpoApplication Object
There are several methods available in the tpoApplication Object. These methods provide access to the currently logged in user, exposes the user’s Company information, and enable hosted pages to perform redirects back to standard Encompass TPO Connect pages.
- getUserData exposes limited information about the user.
/*
* name: getUserData
* parameters: none
* returns: promise
* resolves to object: {
userFullName - user full name
email - email address,
contactID - contact id
externalOrgID - TPO external organization id
roles - user roles
personas - user personas }
*/
tpoAppObject.getUserData().then(function(userSummary) {
console.log('User data ===', userSummary);
});
- getUserProfileData provides complete information about the user.
/*
* name: getUserProfileData
* parameters: none
* returns: promise
* resolves to object: Complete User Profile Object
*/
tpoAppObject.getUserProfileData().then(function(userProfile) {
console.log('User profile data ===', userProfile);
});
- getExternalOrgDetails exposes a user’s Company information.
/*
* name: getExternalOrgDetails
* parameters: none
* returns: promise
* resolves to object: {
“siteId”: “4897532730”,
“companyOrgId”: “167”,
“companyExternalOrgId”: “6514705893”,
“companyName”: “TPOTestOrg”,
“branchOrgId”: <branch name>,
“branchExternalId”: <branch external id>,
“branchName”: “TPOBranchOrg”,
}
Note: branchOrgId, branchExternalId, branchName properties will be available if the logged in user is from a TPO Branch
*/
tpoAppObject.getExternalOrgDetails().then(function(externalOrgData) {
console.log('External Org data ===', externalOrgData);
});
- pageRedirect redirects to a page in the TPO Application.
/*
* name: pageRedirect
* parameters: <pageName>, <loanId>
* returns: promise
* resolves to object: none
*/
tpoAppObject.pageRedirect ('Loan Summary', {id: <loanGuid>});
Methods Available in auth Object
There are two methods available in the auth Object. These methods retrieve an access token and access to the currently logged in user.
- getAccessToken retrieves an access token.
/*
name: getAccessToken
parameters: none
returns: object (example below) { access_token: "0004RgIGOhVvLBOdEQBs0FKkocRd" host_name: "https://api.elliemae.com" token_type: "Bearer" }
*/
// Refer to "Sample Code Generating an Auth Token and make an API call" for actual implementation
- getUser exposes limited information about the user.
/*
* name: getUser
* parameters: none
* returns: promise
* resolves to Object: {
“id”: <user id>,
“realm”: <encompass instance id>,
“firstName”: <user first name>,
“lastName”: <user last name>
}
*/
tpoAuthObject.getUser().then(function(userData) {
console.log('User data ===', userData);
});
Methods Available in loan Object
There are several methods available in the loan Object. These methods provide a complete loan data object, indicates if a loan is read-only, provides a calculated loan data object, and notifies the parent application to fetch and apply changes with updated loan data.
- all provides a complete loan data object.
/*
* name: all
* parameters: none
* returns: promise
* resolves to Object: {
"id": "7087e633-f215-4d56-9f7c-02d97c7c8049",
"loanIdNumber": "100200100349",
"applications": [...],
.
.
.
}
*/
tpoLoanObject.all().then(function(loanData) {
console.log('Loan data ===', loanData);
});
- isReadOnly is a Boolean flag that indicates if the loan is in read only mode.
/*
* name: isReadOnly
* parameters: none
* returns: promise
* resolves to: boolean
*/
tpoLoanObject. isReadOnly().then(function(isReadonlyFlag) {
console.log('Is Read Only Loan ===', isReadonlyFlag);
});
- calculate provides a calculated loan data object.
/*
* name: calculate
* parameters: none
* returns: promise
* resolves to Object: {
"id": "7087e633-f215-4d56-9f7c-02d97c7c8049",
"loanIdNumber": "100200100349",
"applications": [...],
.
.
.
}
*/
tpoLoanObject.calculate().then(function(loanData) {
console.log('Calculated Loan data ===', loanData);
});
- merge notifies the parent application to fetch and apply changes with updated loan data.
Important Note
It is important to perform a merge on the loan object to ensure the local (workspace) loan is refreshed with changes made directly in Encompass. For example, perform a merge operation before the client/child application is closed and the user is returned to the parent (TPO) application.
/*
* name: merge
* parameters: none
* returns: promise
* resolves to Object: {
"id": "7087e633-f215-4d56-9f7c-02d97c7c8049",
"loanIdNumber": "100200100349",
"applications": [...],
.
.
.
}
*/
tpoLoanObject.merge().then(function(loanData) {
console.log('Response after merge ===', loanData); });
Sample Code and Usage Notes for the pageRedirect
To navigate to standard pages/loan actions:
await redirect.pageRedirect('PAGE NAME HERE', {
id: 'LOAN GUID HERE',
});
Standard Pages (case sensitive):
• Loan Summary
• Product Pricing & Lock
• Loan Estimate Fee Management
• Documents
• Conditions
• Enhanced Conditions
• Service Orders
• esign
• Purchase Advice
• Fees
• Disclosure Tracking
• Import Additional Data
• DUAL AUS
• Order Credit
• Order DU
• Order LPA
• Disclosures
• Submit Loan
• Re-Submit Loan
• Withdraw Loan
• Change of circumstance
To navigate to any sub section under URLA 2020:
To navigate to any specific sub-section, you will need to pass one additional parameter named "section”.
await redirect.pageRedirect('urla', {
id: 'LOAN GUID HERE',
section: 'URLA SECTION NAME HERE'
});
Important Note
Custom widgets are not supported.
Section Parameter Values (case sensitive):
• Additional Information
• Lender Loan Information
• Borrower Information
• Loan and Property Information
• Assets and Liabilities
• Real Estate
• Employment and Income
• Information for Government Monitoring
• URLA Continuation
Important Note
When navigating to URLA 2020, if the selected section is "hidden" in TPO Admin URLA 2020 settings, the user will stay on the same SSF page (i.e., navigation will not occur).
Sample Code for TPOC Page Redirect
async function redirect(pageName) {
if (pageName.startsWith("URLA:")) {
var section = pageName.split(':')[1];
await tpoAppObject.pageRedirect('urla', {
id: this.loanId,
section: section
});
} else {
await tpoAppObject.pageRedirect(pageName, {id: this.loanId });
}
}
<select id="redirect" onchange="redirect(this.value);" style="width: 100%;">
<option value="">Quick Links</option>
<option value="Welcome">Welcome</option>
<option value="Loan Summary">Loan Summary</option>
<option value="URLA:Additional Information">URLA: Additional Info</option>
<option value="URLA:Lender Loan Information">URLA: Lender Loan Info</option>
<option value="URLA:Borrower Information">URLA: Borrower Information</option>
<option value="URLA:Loan and Property Information">URLA: Loan & Property</option>
<option value="URLA:Assets and Liabilities">URLA: Assets and Liabilities</option>
<option value="URLA:Real Estate">URLA: Real Estate</option>
<option value="URLA:Employment and Income">URLA: Employment & Income</option>
<option value="URLA:Information for Government Monitoring">URLA: Government Monitoring</option>
<option value="URLA:URLA Continuation">URLA: Continuation</option>
<option value="Product Pricing & Lock">Product Pricing & Lock</option>
<option value="Loan Estimate Fee Management">Loan Estimate Fee Management</option>
<option value="Generate Disclosures">Generate Disclosures</option>
<option value="Service Orders">Service Orders</option>
<option value="Documents">Documents</option>
<option value="Conditions">Conditions</option>
<option value="Enhanced Conditions">Enhanced Conditions</option>
<option value="esign">eSign</option>
<option value="Purchase Advice">Purchase Advice</option>
<option value="Fees">Fees</option>
<option value="Disclosure Tracking">Disclosure Tracking</option>
<option value="Import Additional Data">Import Additional Data</option>
<option value="DUAL AUS">Dual AUS</option>
<option value="Order Credit">Order Credit</option>
<option value="Order DU">Order DU</option>
<option value="Order LPA">Order LPA</option>
<option value="Submit Loan">Submit Loan</option>
<option value="Re-Submit Loan">Re-Submit Loan</option>
<option value="Withdraw Loan">Withdraw Loan</option>
<option value="Change of circumstance">Change of circumstance</option>
</select>
Sample Code Generating an Auth Token and make an API call
async function printAccessToken() {
let auth = await elli.script.getObject('auth');
let http = await elli.script.getObject('http');
let apiPath = '/encompass/v3/system/info';
let respAccessToken = await auth.getAccessToken();
// Sample below to use this token to make API calls
let authToken = respAccessToken.token_type + ' ' + respAccessToken.access_token;
let host = respAccessToken.host_name;
let api = host + apiPath;
let resp = await http.get(api,
{
'Content-Type': 'application/json',
'Authorization': authToken,
});
console.log('Encompass Version : ', resp);
}
For additional information and examples of the server-side token exchange service, see the following resources:
Updated 12 days ago
