The error I am receiving is "Error encountered during rule execution. Index was out of range. Must be non-Negative and less than the size of the collection.Parameter name:index".
I know that this has to do with Attorneys Object not being set, but for the life of me, I cannot seem to figure out the right way to accomplish this.
I would greatly appreciate any suggestions to get past this issue.
Code: Select all
def CDFPointOfContact_Contact_Validate(args):
#def CDFPointOfContact_Contact_Value(args): #Commented for Testing
attorneyState = False
foundAttorney = False # Testing Only
attorneyStateList = 'AL_CT_DE_GA_HI_IA_KY_LA_ME_MD_MA_MS_NH_NJ_NY_NC_ND_RI_SC_TN_VT_VA_WV'
escrowCompanyAssigned = False # Testing Only
# Exit if processing template.
if args.Context.Root.IsTemplate:
args.RaiseInformation('IsTemplate') #This is used to for testing
args.RunDefaultRule()
return
# Exit if not fully initialized
if (args.Context.Parent is None):
args.RaiseInformation('Parent is None') #This is used to for testing
args.RunDefaultRule()
return
c = args.Context
if c.Self == c.Parent.Contacts[2]:
args.RaiseInformation('Processing 3rd CDFPointOfContact') #This is used to for testing
order = args.Context.Root
# Exit if 1st Property Stte is None
if order.Properties[0].Address.State is None:
args.RaiseInformation('1st Property State is None') #This is used to for testing
args.RunDefaultRule()
return
# Get state for the first property and then Test to see if it is in the Attorney State List.
state = order.Properties[0].Address.State
if (state.Code in str(attorneyStateList)):
attorneyState = True
args.RaiseInformation('attorneyState = ' + str(attorneyState)) #This is used to for testing
args.RaiseInformation('1st Property State Code is ' + str(state.Code)) #This is used to for testing
args.RaiseInformation('attorneyState = ' + str(attorneyState)) #This is used to for testing
args.RaiseInformation('attorneyStateList = ' + str(attorneyStateList)) #This is used to for testing
if (attorneyState == True and order.Attorneys[0].Name is not None and order.Attorneys[0].Name != ''):
foundAttorney = True
args.RaiseInformation('Set SetAgtCd on Page 5 to ' + str(order.Attorneys[0].Code)) #This is used to for testing
#args.Value = order.Attorneys[0].Code)
return
# If Not set to the Attorney Contact, then see if it can be set to the Escrow Satus Company.
if (order.Escrow.Office is not None):
escrowCompanyAssigned = True
args.RaiseInformation('Set SetAgtCd on Page 5 to ' + str(order.Escrow.Office)) #This is used to for testing
#args.Value = order.Escrow.Office
return
# Default to SoftPro's Rules when not Attorney State and No Escrow Status Contact Assigned
args.RaiseInformation('Run SoftPro Default Rules') #This is used to for testing
args.RunDefaultRule()
return