Encompass – Code to add a new Milestone Task to a loan.

The following code demonstrates how to add a new MilestoneTask to a 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()
{
// Open the session to the remote server
Session session = new Session();
session.Start(“myserver”, “mary”, “maryspwd”);

Loan loan = session.Loans.Open(“{4c1cd774-96dd-4a92-b703-df8a07b8fc98}”);
loan.Lock();

// Retrieve the “Processing” milestone
Milestone ms = session.Loans.Milestones.Processing;

// Fetch the MilestoneEvent from the loan corresponding to the selected Milestone
MilestoneEvent msEvent = loan.Log.MilestoneEvents.GetEventForMilestone(ms.Name);

// Create the new task on this milestone
MilestoneTask task = loan.Log.MilestoneTasks.Add(“Discuss Life Insurance with Borrower”, msEvent);

// Set some basic properties on the task
task.Priority = TaskPriority.High;
task.DaysToComplete = 10;

// Look up the life insurer contact
StringFieldCriterion cri = new StringFieldCriterion();
cri.FieldName = “Contact.CompanyName”;
cri.Value = “Met Life Insurance”;

ContactList insurers = session.Contacts.Query(cri, ContactLoanMatchType.None, ContactType.Biz);

// Add a contact to the task
if (insurers.Count > 0)
task.Contacts.Add((BizContact) insurers[0]);

// Save and close the loan
loan.Commit();
loan.Close();

// End the session to gracefully disconnect from the server
session.End();
}
}

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.