Setting the Trust Account for an order via the API

Discussions related to custom development with Select.
BobRichards
Posts: 1376
Joined: Wed Jan 15, 2014 3:50 pm
Location: Raleigh, NC
Contact:

Re: Setting the Trust Account for an order via the API

Post by BobRichards »

If you open the order via API, does the "TrustAccountId" tag exist in the Order object's tag collection? Is the guid value a valid trust account?
Bob Richards, Senior Software Developer, SoftPro
dlerickson
Posts: 80
Joined: Tue Jan 21, 2014 11:35 am
Location: Austin, TX

Re: Setting the Trust Account for an order via the API

Post by dlerickson »

In both cases, the answer is "yes." What I'm doing is providing a dropdown list to a user with possible trust accounts, the data for which is pulled as such:

Code: Select all

var accountsManager = SelectServer.GetService<IAccountsManager>();
var trustAccounts = accountsManager.TrustAccounts
	.Where(x => x.Enabled)
	.ToList();
The user selects one of these, and the code to set the order to that Trust Account is as such:

Code: Select all

order.SetTag("TrustAccountId", TrustAccount.ID.ToString());	// TrustAccount is the user-select Trust Account object here
I'm also calling ApplyChanges immediately after this, in an outer scope.
User avatar
uwdoug79
Posts: 78
Joined: Wed Aug 07, 2013 12:43 pm
Location: Earth
Contact:

Re: Setting the Trust Account for an order via the API

Post by uwdoug79 »

So we only have 1 trust account so I wanted to set it directly but this does not appear to be working.

order.SetTag("TrustAccountId", "WICTUSB7743");

should this work ??

Doug
Doug Hamilton
CHICAGO TITLE
20825 SWENSON DR SUITE 300 WAUKESHA, WI 53186
P: 262-796-3808 F: 262-796-3888
EMAIL: Doug.Hamilton@fnf.com
www.wi.ctic.com | www.chicagoagent.com | www.etitle.ws
BobRichards
Posts: 1376
Joined: Wed Jan 15, 2014 3:50 pm
Location: Raleigh, NC
Contact:

Re: Setting the Trust Account for an order via the API

Post by BobRichards »

A TrustAccount.ID is a guid value that we store as a string. You will have to do a lookup of the trust account name to get the guid.

Code: Select all

IAccountsManager accountsManager = SelectServer.GetService<IAccountsManager>();
ITrustAccountInfo trustAccountInfo = accountsManager.TrustAccounts
    .Where(x => x.Code == "WICTUSB7743")
    .FirstOrDefault();

order.SetTag("TrustAccountId", trustAccountInfo.ID.ToString());
	
Bob Richards, Senior Software Developer, SoftPro
Post Reply