So, here are sample codes using Encompass API to batch update lender name
using EllieMae.Encompass.Api;
using EllieMae.Encompass.BusinessObjects.Loans;
// Authenticate with Encompass API
Session session = new Session();
session.Start(“encompass_api_user”, “encompass_api_password”);
// Define loan filter criteria for batch update
LoanFilter loanFilter = new LoanFilter();
loanFilter.AddFilter(LoanField.LoanFolder, “MyFolder”);
loanFilter.AddFilter(LoanField.LoanStatus, LoanStatus.Active);
// Retrieve loans matching the filter criteria
LoanData[] loans = session.Loans.GetList(loanFilter);
// Batch update lender name for each loan
foreach (LoanData loan in loans)
{
loan.Fields[“CX.LenderName”] = “New Lender Name”; // replace “CX.LenderName” with the actual lender name field ID in Encompass
session.Loans.Update(loan);
}
// Close the Encompass API session
session.End();
This code snippet first authenticates with the Encompass API using a username and password. Then it defines an LoanFilter
object to specify the filter criteria for the loans to be batch updated. In this example, we are filtering by loans in a folder named “MyFolder” which has an active status.
Next, it retrieves the list of loans matching the filter criteria using the GetList
method of the Loans
object. This returns an array of LoanData
objects representing the loans.
Finally, it loops through the loans and updates the lender name field (replace “CX.LenderName” with the actual lender name field ID in Encompass) using the Fields
property of the LoanData
object. It then calls the Update
method of the Loans
object to save the changes.
Once the batch update is complete, the Encompass API session is closed using the End
method of the Session
object.