Page 1 of 1

Compare 2 Order Date Values

Posted: Fri Mar 16, 2018 5:09 pm
by johnpbzdon
I'm trying to set up an automation based on a custom date field {{Order.ContractRecd_150280#}} being greater than {{Order.ReceivedDate}}, but having issues. I have tried using the automation "Field is specific value" option with the > comparison operator and designating both fields as showing above, but the automation did NOT trigger. Is there a specific way the fields should be detailed? I have tested each field with a static date and it does trigger, but not when trying to compare the dates together.

If the option won't work, can you provide the code snippet syntax to compare the two fields so "True" is returned?

Re: Compare 2 Order Date Values

Posted: Fri Mar 16, 2018 5:18 pm
by BobRichards
Please provide the code snippet you are trying.

Re: Compare 2 Order Date Values

Posted: Mon Mar 19, 2018 10:15 am
by johnpbzdon
Hi Bob,

Thanks for the quick response.

Below are the date values I'm trying to evaluate.

{{Order.ContractRecd_150280#}} > {{Order.ReceivedDate}}

Since the "Field is specific value" of the Automation Process Wizard's "And if these conditions are met:" doesn't appear to resolve 2 order date values, I'm assuming I will have to use the "Code Snippet" option. I have just started to try and figure out the python syntax. There aren't a lot of examples to pull from so this is what I have so far (which isn't working):

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

def Order_RelatedOrders_Value(args):
# Get context (top level order object).
order = args.Context.Root

if IOrderItem.GetProperty(order, 'ContractRecd_150280#') > order.ReceivedDate
return True

Re: Compare 2 Order Date Values

Posted: Mon Apr 09, 2018 2:16 pm
by BobRichards
This does not appear to be a valid Automation snippet. If you are actually creating a Custom Order Rule, please post to that forum. If you are trying to create an Automation snippet, please let we know so we can change it to a valid format. Thanks.