Setting the Trust Account for an order via the API

Discussions related to custom development with Select.
rdaneel
Posts: 7
Joined: Wed Jun 22, 2011 12:20 pm

Setting the Trust Account for an order via the API

Post by rdaneel » Tue Feb 07, 2012 11:53 am

I might just be missing it, but where do you set the trust account for an order during creation via the API?

Thanks,
Michael

john.morton
Posts: 89
Joined: Wed Nov 16, 2011 11:51 am

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

Post by john.morton » Fri Feb 10, 2012 11:26 am

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

rdaneel
Posts: 7
Joined: Wed Jun 22, 2011 12:20 pm

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

Post by rdaneel » Fri Feb 10, 2012 12:59 pm

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

Melissa McBerkowitz
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

Post by Melissa McBerkowitz » Fri Feb 10, 2012 2:41 pm

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

rdaneel
Posts: 7
Joined: Wed Jun 22, 2011 12:20 pm

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

Post by rdaneel » Mon Feb 13, 2012 1:21 pm

Thanks Melissa. I might just take you up on the offer for a beta when the API comes out. I appreciate the help!

mrisen
Posts: 98
Joined: Wed Jul 25, 2012 7:01 pm

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

Post by mrisen » Tue Feb 10, 2015 6:50 pm

How do you set the trust account via the API with SoftPro 3.0?

sindrapal
Posts: 42
Joined: Tue Oct 14, 2008 9:21 am

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

Post by sindrapal » Wed Feb 11, 2015 10:46 am

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);
                }
            }

mrisen
Posts: 98
Joined: Wed Jul 25, 2012 7:01 pm

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

Post by mrisen » Wed Feb 11, 2015 3:12 pm

Thank you. However, I was trying to set the trust account on an existing order. Can you provide some code to do that?

sindrapal
Posts: 42
Joined: Tue Oct 14, 2008 9:21 am

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

Post by sindrapal » Thu Feb 12, 2015 12:32 pm

For an existing order, you just set a tag for the trust account id.

_order.SetTag("TrustAccountId", trustAccountID.ToString());

mrisen
Posts: 98
Joined: Wed Jul 25, 2012 7:01 pm

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

Post by mrisen » Thu Feb 12, 2015 3:19 pm

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());
            }
        }

Post Reply