The following code creates a new Lock Request on an existing loan.
using System;
using System.IO;
using EllieMae.Encompass.Client;
using EllieMae.Encompass.BusinessEnums;
using EllieMae.Encompass.BusinessObjects;
using EllieMae.Encompass.BusinessObjects.Loans;
using EllieMae.Encompass.BusinessObjects.Loans.Logging;
class LoanReader
{
public static void Main(string[] args)
{
// Open the session to the remote server
Session session = new Session();
session.Start(“myserver”, “mary”, “maryspwd”);
// Open and lock the loan
Loan loan = session.Loans.Open(args[0]);
loan.Lock();
// Populate the lock request data in the loan. For many of these fields, we can simply
// copy the data from the basic loan information since we want to use that same information
// for the lock request. However, it’s possible to pass information to the lock request
// which differs from the actual values in the loan.
loan.Fields[“2951”].Value = loan.Fields[“19”].Value;
loan.Fields[“2952”].Value = loan.Fields[“1172”].Value;
loan.Fields[“2953”].Value = loan.Fields[“608”].Value;
loan.Fields[“2958”].Value = loan.Fields[“420”].Value;
// Populate the requested lock date and lock period
loan.Fields[“2089”].Value = DateTime.Today;
loan.Fields[“2090”].Value = 30;
// Now create the new LockRequest. This is equivalent to pressing the Request Lock button
// on the Lock Request Form.
LockRequest request = loan.Log.LockRequests.Add();
// Save and close the loan file
loan.Commit();
loan.Close();
// End the session to gracefully disconnect from the server
session.End();
}
}