Server package order changes not reflected in open tab

Discussions related to custom development with Select.
kwesterlage
Posts: 73
Joined: Thu May 21, 2015 2:28 pm

Server package order changes not reflected in open tab

Post by kwesterlage »

We have created a server package dedicated to automatically completing order tasks when certain conditions are true.
When all the transactions are posted, we are automatically completing one of the checklist tasks and re-saving the (currently open) order.
Our problem happens when the task and the triggering event is completed (and our logs show the logic was hit), the open order does not reflect any of the server-side changes.

Is it possible to make changes to an order in a server-package on a order/ledger triggered event, and have those changes reflected on the client side?
* without closing and re-opening the order *

If not, what would best practice alternatives for this situation look like?
BobRichards
Posts: 1377
Joined: Wed Jan 15, 2014 3:50 pm
Location: Raleigh, NC
Contact:

Re: Server package order changes not reflected in open tab

Post by BobRichards »

If the order is open on a client Select session, you will not be able to open the order in the server package (or anywhere else) as writable.

If the the server package is getting the order that is open on the client via handler (such as IOrderStore.OrderSaving), you are not allowed to make any changes to the order with the exception of IOrderItem tags since any other server made changes will NOT flow back to the client.
Bob Richards, Senior Software Developer, SoftPro
John Morris
Posts: 411
Joined: Thu Sep 11, 2008 11:35 am
Location: Raleigh, NC, USA
Contact:

Re: Server package order changes not reflected in open tab

Post by John Morris »

The restriction that Bob refers to was lifted in the 4.0.5.x releases. If you are running the latest version of Select, you CAN make changes to the order during the server's handling of the IOrderStore::OrderSaving event. The server will send a diffgram back to the client, allowing the client to sync up those changes and the user will see the net effect.
John Morris
Sr. Software Architect
SoftPro
kwesterlage
Posts: 73
Joined: Thu May 21, 2015 2:28 pm

Re: Server package order changes not reflected in open tab

Post by kwesterlage »

Thanks, I will try this again when we finish upgrading.
kwesterlage
Posts: 73
Joined: Thu May 21, 2015 2:28 pm

Re: Server package order changes not reflected in open tab

Post by kwesterlage »

Also, is there an event that gets fired whenever you post a check?
None of the events in the transaction manager seem to work; I have been using TransactionAdded and TransactionChanged for everything else.
chris.brady
Posts: 105
Joined: Wed Oct 17, 2012 4:20 pm

Re: Server package order changes not reflected in open tab

Post by chris.brady »

So far, most changes made in the server package during OrderSaving is reflected on the client after the save completes. However, we've noticed with Checklist tasks that modifying the task status within the server package isn't reflected on the client until the order is reopened. Specifically, when setting the status to Required. I have not tried setting the status to anything else to see if the change is reflected.

Is there a limitation to what will be refreshed when the diffgram is sent back to the client?

We're running version 4.1.40101.11.
John Morris
Posts: 411
Joined: Thu Sep 11, 2008 11:35 am
Location: Raleigh, NC, USA
Contact:

Re: Server package order changes not reflected in open tab

Post by John Morris »

No, there isn't a limit. Can you provide some sample code that reproduces this?
John Morris
Sr. Software Architect
SoftPro
chris.brady
Posts: 105
Joined: Wed Oct 17, 2012 4:20 pm

Re: Server package order changes not reflected in open tab

Post by chris.brady »

Sure. This method is attached to the OrderSaving event.

Code: Select all

       public void AutoAddDeliverUnderwriterPolicyAndRemittance(object sender, OrderSavingEventArgs args)
        {
            dynamic order = args.Order;
            IEnumerable<dynamic> tasks = order.Tasks;
            try
            {
                dynamic task = tasks.Where(x => x.Description == "Deliver Underwriter Policy and Remittance").FirstOrDefault();
                if (task == null)
                {
                    dynamic deliverUwPolicyAndRemittance = ((IOrder)order).CreateNew("ChecklistTask");
                    deliverUwPolicyAndRemittance.Description = "Deliver Underwriter Policy and Remittance";
                    deliverUwPolicyAndRemittance.Status = TaskStatusType.Required;
                    deliverUwPolicyAndRemittance.AssignedTo = GetService<ISecurityManager>().Identities.Where(x => x.FullName == "U/W Remittance").FirstOrDefault();
                    order.Tasks.Add(deliverUwPolicyAndRemittance);
                }
                else if (task.Status != TaskStatusType.Completed && task.Status != TaskStatusType.NA)
                {
                    task.Status = TaskStatusType.Required;
                    if (task.AssignedTo == null) task.AssignedTo = GetService<ISecurityManager>().Identities.Where(x => x.FullName == "U/W Remittance").FirstOrDefault();
                }
            }
            catch (Exception ex)
            {
                Log.Error(ex);
            }            
        }
chris.brady
Posts: 105
Joined: Wed Oct 17, 2012 4:20 pm

Re: Server package order changes not reflected in open tab

Post by chris.brady »

Was this issue ever resolved? We still see this issue. We're on version 4.2.3.3 (4.2.41213.16)
chris.brady
Posts: 105
Joined: Wed Oct 17, 2012 4:20 pm

Re: Server package order changes not reflected in open tab

Post by chris.brady »

Do you need additional information beyond the previous posts to understand the issue?
Post Reply