Setting the Trust Account for an order via the API
Setting the Trust Account for an order via the API
I might just be missing it, but where do you set the trust account for an order during creation via the API?
Thanks,
Michael
Thanks,
Michael
-
- Posts: 89
- Joined: Wed Nov 16, 2011 11:51 am
Re: Setting the Trust Account for an order via the API
From an IOrder, you can get a list of ITransactions, and the ITrustAccount they are associated with. Unfortunately, with the current API, you can't set the Trust Account for an order. Much more of this functionality will be available with our next major release (Cameron).
Re: Setting the Trust Account for an order via the API
Thank you for the information. Is there an ETA on the next release? Also, is there a list of additional potential functionality that will be in the release available?
Thanks Again,
Michael
Thanks Again,
Michael
-
- Posts: 91
- Joined: Wed Sep 10, 2008 3:33 pm
- Location: Raleigh, NC
- Contact:
Re: Setting the Trust Account for an order via the API
No solid ETA yet, but it will be later this year. The primary changes are improved performance and read/write APIs for nearly all the data that you couldn't access previously, including all the ProTrust/transaction data. We will be actively seeking developer feedback this summer, so if you'd be interested in participating in beta testing for those new APIs, please let me know!
Melissa McBerkowitz
VP of Product Strategy, SoftPro
VP of Product Strategy, SoftPro
Re: Setting the Trust Account for an order via the API
Thanks Melissa. I might just take you up on the offer for a beta when the API comes out. I appreciate the help!
Re: Setting the Trust Account for an order via the API
How do you set the trust account via the API with SoftPro 3.0?
Re: Setting the Trust Account for an order via the API
Please refer to the code sample below that shows how to set the trust account on an order in 3.0. Let me know if you have any questions.
Code: Select all
// sample to illustrate the creation of an order (blank) with a trust account
IAccountsManager am = _sps.GetService<IAccountsManager>();
ITrustAccountInfo tacInfo = am.TrustAccounts
.Where(ta => ta.Code == "TACode")
.SingleOrDefault();
if (tacInfo != null)
{
OrderCreationSpec spec = new OrderCreationSpec();
spec.BaseNumber = "TestOrder1";
spec.Settings.Add("TrustAccountId", tacInfo.ID.ToString());
IOrderStore os = _sps.GetService<IOrderStore>();
using (IOrder order = os.NewOrder(spec))
{
// order save
os.ApplyChanges(order);
}
}
Re: Setting the Trust Account for an order via the API
Thank you. However, I was trying to set the trust account on an existing order. Can you provide some code to do that?
Re: Setting the Trust Account for an order via the API
For an existing order, you just set a tag for the trust account id.
_order.SetTag("TrustAccountId", trustAccountID.ToString());
_order.SetTag("TrustAccountId", trustAccountID.ToString());
Re: Setting the Trust Account for an order via the API
Hmm... that seemed to work but afterward, when I go into SoftPro, open the order, and click on the Register button, I get the Select Trust Account dialog box, which should not appear. Can you take a look at my function and tell me if I am missing something?
Code: Select all
public void AddTrustAccount(string orderNumber)
{
var configuration = GetConfiguration();
using (var selectServer = GetSelectServer(configuration))
{
var orderStore = selectServer.GetService<IOrderStore>();
var orderInfo = orderStore.Orders.FirstOrDefault(x => x.Number == orderNumber);
var order = orderStore.OpenOrder(orderInfo, false);
var accountsManager = selectServer.GetService<IAccountsManager>();
var trustAccountInfo = accountsManager.TrustAccounts.FirstOrDefault();
order.SetTag("TrustAccountId", trustAccountInfo.ID.ToString());
}
}