Code Assistance

Questions about and code samples for automation process code snippets within Select.
Post Reply
cklahr
Posts: 71
Joined: Tue Oct 27, 2009 3:32 am

Code Assistance

Post by cklahr »

Good morning,

I'm trying to add criteria to an automation snippet based on the below code snippet. I would like the system to check the Buyer contacts in the case of a purchase, and the lender contact in the case of a Refinance. If the contact name is "TBD" or "To be determined" the return should be false.

Thank you so much!

Code: Select all

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

def OrderContactsNotTBD():

	if Context.TransactionType = 'Purchase':
		return True
			
	for contact in Context.Buyers:
		if contact.Name == 'TBD' or contact.Name == 'To be determined':
			return False
		else:
			return True
		
OrderContactsNotTBD()
PaulMcCullough
Posts: 23
Joined: Wed Jul 12, 2023 11:29 am

Re: Code Assistance

Post by PaulMcCullough »

To compare TransactionType you need to use the values TransactionType.Purchase and TransactionType.Refinance instead of string values.

I think the following should do what you described.

Code: Select all

# For Purchase transactions this checks the Buyer names
# For Refinance transactions this checks the Lender names
# If at least one Contact has the name 'TBD' or 'To be determined' it returns False
# For everything else it returns True

def OrderContactsNotTBD():

	if Context.TransactionType == TransactionType.Purchase:
		for contact in Context.Buyers:
			if contact.Name == 'TBD' or contact.Name == 'To be determined':
				return False
				
	elif Context.TransactionType == TransactionType.Refinance:
		for contact in Context.Lenders:
			if contact.Name == 'TBD' or contact.Name == 'To be determined':
				return False

	return True
cklahr
Posts: 71
Joined: Tue Oct 27, 2009 3:32 am

Re: Code Assistance

Post by cklahr »

Thank you very much!
Post Reply