Automation Error when Evaluating

Questions about and code samples for automation process code snippets within Select.
Post Reply
tmeisinger
Posts: 75
Joined: Fri Apr 24, 2015 10:33 am

Automation Error when Evaluating

Post by tmeisinger »

I'm getting "An unexpected error occurred while evaluting the conditions for process OE Audit". Any help would be appreciated. It runs successful some times, but fails with this error on Save some times. Is there anyplace to debug automation?

It is a fairly simple Automation where we want to assign an Audit Task if a new users entered the order.

First time an order is saved
when "Field is a specific value", {{Order.ReceivedDate}} >= 07/27/2021
and a code snippet that evaluates to true (below)

Code: Select all

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

oePerson = Context.ReceivedBy.Name.lower()

def IsNewOE(oe):
	if oe == 'domain\name1':
		return True
	elif oe == 'domain\name2':
		return True
	else:
		return False
		
IsNewOE(oePerson)
tmeisinger
Posts: 75
Joined: Fri Apr 24, 2015 10:33 am

Re: Automation Error when Evaluating

Post by tmeisinger »

Pretty sure my problem is trying to get the User's Name that Entered the Order on first Save.

oePerson = Context.ReceivedBy.Name.lower()

Help Please,
-TM
mhoutz
Posts: 14
Joined: Wed Dec 14, 2016 5:22 pm

Re: Automation Error when Evaluating

Post by mhoutz »

Hi TM,

Can you tell me the version of Select you're using? Just want to make sure we test this on the same version.

Also, are you sure that the recievedName will never be blank or null?

Mike
mhoutz
Posts: 14
Joined: Wed Dec 14, 2016 5:22 pm

Re: Automation Error when Evaluating

Post by mhoutz »

Also, I noticed you wanted a way to debug your code below. That is possible. You can open a new order, and use the shortcut shift+F12. The softpro development screen should come up with a folder called modules.

You can add a new module, then add your code below. You can place break points on any line. Save the module, then save the order, and you should see your code run step by step. This is a helpful tool to debug anything you're putting in automation as a snippet.
tmeisinger
Posts: 75
Joined: Fri Apr 24, 2015 10:33 am

Re: Automation Error when Evaluating

Post by tmeisinger »

Thanks Mike, we are using 4.3.60210.48
mhoutz
Posts: 14
Joined: Wed Dec 14, 2016 5:22 pm

Re: Automation Error when Evaluating

Post by mhoutz »

Thanks for the version info! Can you try debugging on your side to see if the order will always contain a value for ReceivedBy Name? Note that occasionally, users don't have a 'name' but do have a login.

I'm still confused as to what your goal is with this automation. You want to add a task every time the order is saved?

Thanks,

Mike
tmeisinger
Posts: 75
Joined: Fri Apr 24, 2015 10:33 am

Re: Automation Error when Evaluating

Post by tmeisinger »

Details of why isn't as important to what Bob Richards was able to help me out with...

oePerson = Context.ReceivedBy.Name.lower() vs. oePerson = Context.ReceivedBy.Name.ToLower()

Not sure I'm smart enough to explain, but ".lower()" is Python and ".ToLower()" is .NET.

.NET works much better.

Problem solved,
-TM
Post Reply