Apply GetBusinessDay API method to COR and account for Office Hours Manager profile membership inheritance

Questions about and code samples for custom order rules and validation within Select.
Post Reply
Sharp
Posts: 2
Joined: Tue Dec 02, 2008 3:54 pm
Location: Raleigh, NC

Apply GetBusinessDay API method to COR and account for Office Hours Manager profile membership inheritance

Post by Sharp » Fri Feb 16, 2018 11:20 am

I have a COR that will currently loop through all available office hours managers to locate and apply office hours based on the order's ownership profile, however I do not understand how to apply inheritance to get the manager that would implicitly apply to child profiles.

For example, office hours manager ABC is assigned to Default, and I have an order that is created on Default\BranchA. I also need to ensure that if there is a manager explicitly assigned to the order's owning profile, that any higher level associations are ignored (if manager XYZ is assigned to Default\BranchA, manager ABC would be ignored).

Here's the code thus far:

from System import *
from SoftPro.ClientModel import *
from SoftPro.OrderTracking.Client import *
from SoftPro.OrderTracking.Client.Orders import *
from SoftPro.Select.Client.Calendar import *
import clr


def Order_SettlementDate_Value(args):
order = args.Context
thisOfficeHrs = None
receivedDate = order.ReceivedDate
daysTillSett = IOrderItem.GetProperty(order, 'DaysTillSett_FNFSCA#')
calendarSvc = args.GetService(clr.GetClrType(IOfficeCalendar))

oh = IOfficeCalendar.OfficeHours.GetValue(calendarSvc)

for officeHrs in oh:
for profiles in officeHrs.Profiles:
if profiles.Path == order.OwnershipProfile.Path:
thisOfficeHrs = officeHrs
break

if thisOfficeHrs is None:
return

oh2 = IOfficeHours.GetBusinessDay(thisOfficeHrs,receivedDate.AddDays(30))

if order.IsTemplate or order.IsCommercial:
return


if daysTillSett == 'None' or daysTillSett == 0 or daysTillSett == '':
args.Value = IOfficeHours.GetBusinessDay(thisOfficeHrs,receivedDate.AddDays(30))
else:
args.Value = IOfficeHours.GetBusinessDay(thisOfficeHrs,receivedDate.AddDays(daysTillSett))

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

Re: Apply GetBusinessDay API method to COR and account for Office Hours Manager profile membership inheritance

Post by BobRichards » Mon Feb 26, 2018 5:25 pm

This should be avoided for two reasons:
  • The call would result in a call to the database that could slow down the user experience.
  • The DLR environment that IronPython uses will not take advantage of the helpers we have created for processing a list originating from the database/server. This will result in the entire set of all OfficeHours object being sent to the client and then filtering. This extra data can also slow down the user response time.
Bob Richards, Software Developer, SoftPro

Post Reply