Python Code - Fail condition if Other Contact Name is Present
Posted: Thu Aug 09, 2018 2:00 pm
Hoping this is a quick question and you can steer me in the right direction. I am trying to have the Python code iterate over all the Other contacts and fail the condition if a specific name is found. There will always be at least 3 Other contacts in every order (Other Type: CLIENT, REFERRAL SOURCE, OTHER). The issue I am running in to is it passes the condition unless all of the Other contacts in the order are the specified value.
Here is the code I have is there anything in here that I can tweak?
from System import *
from SoftPro.ClientModel import *
from SoftPro.Select.Client import *
## Context is Other contact
## Fail the condition if Other contact name is one of the following names listed in Names below
## Pass the condition if none of the Other contact names are present
def OtherContactNameExclusionList():
for names in Context.Name:
Names = ['MyTitleCompany, LLC', 'YourTitleCompany, LLC']
if str(Context.Name) in Names:
return False
return True
OtherContactNameExclusionList()
Attached is a screen print of the automation process the red box is where I have this code snippet in question.
I ran in to the same issue when I was just using the automation wizard to look for Other contact with name <> MyTitleCompany, LLC. It would trigger the automation unless all of the Other contacts in the order are the specified value. Logically if it finds any other contacts that are not MyTitleCompany, LLC it triggers the automation.
I think python will offer a more flexible and scalable solution as we are going away from workflows and replacing it with automation processes that will add a sets of task when a specific other contact combinations (CLIENT and REFERRAL SOURCE combination) are present. So I want to prevent an automation from adding tasks to an order if specific names are in contacts. For example I don't want the automation to trigger if MyTitleCompany, LLC is an Other Contact (other type = REFERRAL SOURCE) and YourTitleCompany, LLC is an Other Contact (other type = CLIENT) . So I need a way to exclude those other contact combinations from the automation processes that are adding similar sets of tasks.
Any help or direction you can offer would be greatly appreciated.
Here is the code I have is there anything in here that I can tweak?
from System import *
from SoftPro.ClientModel import *
from SoftPro.Select.Client import *
## Context is Other contact
## Fail the condition if Other contact name is one of the following names listed in Names below
## Pass the condition if none of the Other contact names are present
def OtherContactNameExclusionList():
for names in Context.Name:
Names = ['MyTitleCompany, LLC', 'YourTitleCompany, LLC']
if str(Context.Name) in Names:
return False
return True
OtherContactNameExclusionList()
Attached is a screen print of the automation process the red box is where I have this code snippet in question.
I ran in to the same issue when I was just using the automation wizard to look for Other contact with name <> MyTitleCompany, LLC. It would trigger the automation unless all of the Other contacts in the order are the specified value. Logically if it finds any other contacts that are not MyTitleCompany, LLC it triggers the automation.
I think python will offer a more flexible and scalable solution as we are going away from workflows and replacing it with automation processes that will add a sets of task when a specific other contact combinations (CLIENT and REFERRAL SOURCE combination) are present. So I want to prevent an automation from adding tasks to an order if specific names are in contacts. For example I don't want the automation to trigger if MyTitleCompany, LLC is an Other Contact (other type = REFERRAL SOURCE) and YourTitleCompany, LLC is an Other Contact (other type = CLIENT) . So I need a way to exclude those other contact combinations from the automation processes that are adding similar sets of tasks.
Any help or direction you can offer would be greatly appreciated.