Automation Error when Evaluating

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

Automation Error when Evaluating

Post by tmeisinger » Tue Jul 27, 2021 11:46 am

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: 74
Joined: Fri Apr 24, 2015 10:33 am

Re: Automation Error when Evaluating

Post by tmeisinger » Mon Aug 02, 2021 11:43 am

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 » Wed Aug 04, 2021 11:28 am

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 » Wed Aug 04, 2021 11:42 am

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: 74
Joined: Fri Apr 24, 2015 10:33 am

Re: Automation Error when Evaluating

Post by tmeisinger » Wed Aug 04, 2021 12:05 pm

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 » Thu Aug 05, 2021 9:58 am

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: 74
Joined: Fri Apr 24, 2015 10:33 am

Re: Automation Error when Evaluating

Post by tmeisinger » Mon Aug 09, 2021 4:24 pm

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