Encompass SDK – how to use the LoanFields object to access various fields on a Loan.

The following code demonstrates how to use the LoanFields object to access various fields on a Loan.

using System;
using System.IO;
using EllieMae.Encompass.Client;
using EllieMae.Encompass.BusinessObjects;
using EllieMae.Encompass.BusinessObjects.Loans;

class LoanManager
public static void Main(string[] args)
// Open the session to the remote server
Session session = new Session();
session.Start(“myserver”, “mary”, “maryspwd”);

// Open an existing loan using the GUID from the command line
Loan loan = session.Loans.Open(args[0]);

// Print our the property address for the loan. Since there’s only a
// single value for each field, just use the field ID directly with
// the LoanFields indexer property.
Console.WriteLine(“Street: ” + loan.Fields[“11”].Value);
Console.WriteLine(“City: ” + loan.Fields[“12”].Value);
Console.WriteLine(“County: ” + loan.Fields[“13”].Value);
Console.WriteLine(“State: ” + loan.Fields[“14”].Value);

// Now print out the names of the “primary” Borrower pair.
// Since this pair is primary, we can use the field IDs directly
// with the indexer property.
Console.WriteLine(“Borrower First Name: ” + loan.Fields[“36”].Value);
Console.WriteLine(“Borrower Last Name: ” + loan.Fields[“37”].Value);
Console.WriteLine(“CoBorrower First Name: ” + loan.Fields[“68”].Value);
Console.WriteLine(“CoBorrower Last Name: ” + loan.Fields[“69”].Value);

// Now output the name of all of the other borrower pairs.
for (int i = 0; i < loan.BorrowerPairs.Count; i++)
BorrowerPair pair = loan.BorrowerPairs[i];

if (pair != loan.BorrowerPairs.Current)
// Because these pairs are not the Current (i.e. primary) pair, we
// must use the GetValueForBorrowerPair() function to get the field
// value for the specified pair.
Console.WriteLine(“Borrower Pair ” + i + “:”);
Console.WriteLine(“Borrower First Name: ” + loan.Fields[“36”].GetValueForBorrowerPair(pair));
Console.WriteLine(“Borrower Last Name: ” + loan.Fields[“37”].GetValueForBorrowerPair(pair));
Console.WriteLine(“CoBorrower First Name: ” + loan.Fields[“68”].GetValueForBorrowerPair(pair));
Console.WriteLine(“CoBorrower Last Name: ” + loan.Fields[“69”].GetValueForBorrowerPair(pair));

// Dump the liability verification records for the loan
for (int i = 1; i <= loan.Liabilities.Count; i++)
// Use the LoanField object’s GetFieldAt() method to get the field value for
// a specified liablity.
Console.WriteLine(“Liability ” + i + “:”);
Console.WriteLine(“Holder: ” + loan.Fields.GetFieldAt(“FL02”, i).Value);
Console.WriteLine(“Account: ” + loan.Fields.GetFieldAt(“FL10”, i).Value);

// Alternatively, you can construct the entire loan field ID manually
// for the specific subitem.
Console.WriteLine(“Balance: ” + loan.Fields[“FL” + i.ToString(“00”) + “13”].Value);

// Close the loan to release its resources

// End the session to gracefully disconnect from the server

You may also like...

Popular Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.