Business Objects in Business Rule Module

Discussions related to custom development with Select.
Post Reply
ckootg
Posts: 122
Joined: Fri Jan 06, 2012 6:10 pm

Business Objects in Business Rule Module

Post by ckootg »

I've been trying to build a Business Rule module by following this thread (viewtopic.php?f=11&t=180). The module I built, runs, however, the data passed to it are of type SoftPro.BusinessObjects.Core.*, all of which are private. The work around I tried was to use the OrderTrackingClient to get the order. This also has problems because the order is locked if the it doesn't pass all the business rules, as noted in this thread (viewtopic.php?f=9&t=233). Is there a way to use the Core objects as is? Or is there a way to convert the Core objects into their public interface equivalent (ie., IOrder) without actually retrieving the data via the OrderTrackingClient?
Randy Mellow

Re: Business Objects in Business Rule Module

Post by Randy Mellow »

Can you be more specific (perhaps with a small example) of what you are trying to do with objects from BusinessObjects.Core? When creating business rules it is generally not necessary (if it's even supported) to access objects beyond what gets passed into the rule via the InputParameterHandle parameters. Further, the business engine does not support drilling down into the business objects that do get passed. Any object or property you need to access inside your business rule has to be passed to the rule through the InputParameterHandle parameters.
ckootg
Posts: 122
Joined: Fri Jan 06, 2012 6:10 pm

Re: Business Objects in Business Rule Module

Post by ckootg »

We export data from SoftPro to support several legacy systems, so we need a way to verify the data before we extract it. In one scenario, if an existing lien needs to be satisfied/released, a payoff lender contact needs to exist. So, I created a business rule that executes when the order is saved, passing in the order (InputParameterHandle<IBusinessObject>). From there, using the OrderTrackingClient -- as discussed below -- to get the IOder, I loop through the existing liens and contacts to verify the data.

I've tried passing just the exising liens and contacts but I don't think I have the right business rule definition. Here's a couple of ways I've tried defining them as:

Code: Select all

  <Instance>
    <Name>TGCustomOrderValidations</Name>
    <BusinessRule>CustomOrderValidations</BusinessRule>
    <BusinessObjectContext>Order</BusinessObjectContext>
    <Persist>False</Persist>
    <HideFromUser>True</HideFromUser>
    <SaveValidationInstance />
    <InputList>
      <Input>
        <Order>0</Order>
        <Source>ExistingSecurityInstruments</Source>
      </Input>
      <Input>
        <Order>1</Order>
        <Source>Contacts</Source>
      </Input>
    </InputList>
  </Instance>

Code: Select all

  <Instance>
    <Name>TGCustomOrderValidations</Name>
    <BusinessRule>CustomOrderValidations</BusinessRule>
    <BusinessObjectContext>Order</BusinessObjectContext>
    <Persist>False</Persist>
    <HideFromUser>True</HideFromUser>
    <SaveValidationInstance />
    <InputList>
      <Input>
        <Order>0</Order>
        <Source>RootContext\ExistingSecurityInstruments</Source>
      </Input>
      <Input>
        <Order>1</Order>
        <Source>RootContext\Contacts</Source>
      </Input>
    </InputList>
  </Instance>
Melissa McBerkowitz
Posts: 91
Joined: Wed Sep 10, 2008 3:33 pm
Location: Raleigh, NC
Contact:

Re: Business Objects in Business Rule Module

Post by Melissa McBerkowitz »

Both of those samples look correct and should work. You could also use "PayoffLenders" in place of "Contacts" so only the payoff lender contacts are passed into your rule.

Since both of these paths return collections, your business rule parameters need to expect that. For example:

InputParameterHandle<IBusinessObject[]> payoffLenders

rather than:

InputParameterHandle<IBusinessObject> payoffLenders

Also note: If you're validating the data on those objects (not just validating that an object exists in the collection), you need to pass in each of the data items you're validating as a separate parameter.The rules fire based on their dependencies changing. If your rule depends on the collection itself, it will be triggered only when the number of objects in the collection change, not when the individual properties on those objects change. Perhaps a better parameter would be:

<InputList>
<Input>
<Order>0</Order>
<Source>RootContext/ExistingSecurityInstruments/RequireRelease</Source>
</Input>
<Input>
<Order>1</Order>
<Source>RootContext/PayoffLenders</Source>
</Input>
</InputList>

This format would trigger the rule to refire whenever the RequireRelease field changes (the checkbox labeled "Lien must be satisfied/released" on the existing liens screen).
Melissa McBerkowitz
VP of Product Strategy, SoftPro
Post Reply