Encompass – how to use the Refresh method to restore the prior data to an opportunity

The following code demonstrates how to use the Refresh method to restore the prior data to an opportunity.

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

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

// Retrieve an existing contact from the server
BorrowerContact contact = (BorrowerContact) session.Contacts.Open(209, ContactType.Borrower);

// Retrieve the borrower’s Opportunity
ContactOpportunity opp = contact.Opportunities[0];

// Change the loan amount on the opportunity
opp.LoanAmount = opp.LoanAmount + 10000;

// Refresh the opportunity to restore the original values
opp.Refresh();

// Print the Loan Amount — it should reflect the value before we changed
// it with the code above
Console.WriteLine(opp.LoanAmount.ToString());

// 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.