Settlement Location - Settlement Location Type

Discussions related to SoftPro Select user interface development.

Moderator: Phil Barton

Post Reply
mmregan
Posts: 17
Joined: Tue Mar 09, 2010 2:27 pm

Settlement Location - Settlement Location Type

Post by mmregan » Mon May 17, 2021 9:59 am

On the Order Information screen in SPS there is a Settlement Location. It includes a Settlement Location Type radio button, backed by the SettlementLocationType enum values of Contact, Property, Other.

I am attempting to programmatically alter the SettlementLocation using the API while the order is open (getting a reference to the active order). I come into the order with the default SettlementLocationType (Contact) and want to switch it to Other, then update the details.

After some trial and error I learned that one cannot directly write to the SettlementLocationType property on the Order.SettlementLocation object. Although it has a public SET, altering it raises a member access exception. What does seem to work, generally speaking, is to set

Code: Select all

Order.SettlementLocation.Place = Order.SettlementLocation.Other
. This moves the OtherSettlementLocation object into the Place, and causes SPS to update the Order.SettlementLocation.SettlementLocationType to "Other". Exactly what I wanted.

The problem? The SPS Shell UI does not actually change the value of the radio button, causing my changes to be "invisible". Is something in the above incorrect? When I take this same approach server side without having the order open in the Shell, the changes play out as I hope, with the radio button showing settlement location type of Other on next order load.

BobRichards
Posts: 1116
Joined: Wed Jan 15, 2014 3:50 pm
Location: Raleigh, NC
Contact:

Re: Settlement Location - Settlement Location Type

Post by BobRichards » Tue May 18, 2021 4:45 pm

I'm not sure what to do to get the Select UI to update when a shell package changes the Settlement Location. This problem also effects Custom Order Rules that do the same action. I have submitted the issue to R&D to see what they have to say but I no resolution at this time.

Also - SettlementLocationType (like many IOrderItem properties) may have read/write access but the internal business rules can overwrite this behavior as required. This property functions only to output a C# enum value that reflects the current state of the Settlement Location state. The enum is available for use. See "SettlementLocationType" in the SDK.

Finally, if you can use the current functionality, here are examples of how to change the Settlement Location.

Order Contact...

Code: Select all

// Get the first settlement agent.
IOrderItem contact = (IOrderItem)(order.GetProperty<IList>("SettlementAgents"))[0];

// Set the location to the settlement agent office.
IOrderItem sl = order.GetProperty<IOrderItem>("SettlementLocation");
sl.SetProperty("Place", contact);
Order Property...

Code: Select all

// Get the first order property.
IOrderItem property = (IOrderItem)(order.GetProperty<IList>("Properties"))[0];

// Set the location to the settlement agent office.
IOrderItem sl = order.GetProperty<IOrderItem>("SettlementLocation");
sl.SetProperty("Place", property);
Other

Code: Select all

// Set the "Place" to the "Other" property value.
IOrderItem sl = order.GetProperty<IOrderItem>("SettlementLocation");
IOrderItem other = sl.GetProperty<IOrderItem>("Other");
sl.SetProperty("Place", other);
Bob Richards, Senior Software Developer, SoftPro

mmregan
Posts: 17
Joined: Tue Mar 09, 2010 2:27 pm

Re: Settlement Location - Settlement Location Type

Post by mmregan » Tue May 18, 2021 6:04 pm

Thank you @BobRichards, glad I did not spend more time trying to fight this! Appreciate you submitting the issue to R&D.

Great guidance on setting the SettlementLocation.Place

Post Reply