Using "Contains" in Mapping
Posted: Wed Nov 11, 2020 6:11 pm
Is there a way to use "name contains" in mapping? I'm trying to allow for multiple versions of a contact name.
Ex: Wells Fargo Inc, Wells Fargo Mortgage, etc.
Ex: Wells Fargo Inc, Wells Fargo Mortgage, etc.
Code: Select all
from System import *
from SoftPro.ClientModel import *
from SoftPro.Select.Client import *
import clr
import System
clr.AddReference('System.Core')
clr.ImportExtensions(System.Linq)
# Get the contact by contact code
def getContactByType(type):
contact = Context.Others.Where(lambda c: c.OtherType.lower() == type).FirstOrDefault()
return contact
lender = Context.Lenders[0].Name.ToUpper()
# Dictionary to map Lender names to Final Policy Lender
# Update as necessary (use upper case)
mapping = {'WELLS FARGO':'WF1', 'Bank of America':'BOA1', 'City Bank':'CTY1'}
other = getContactByType('final policy lender')
# if we have both contacts and found a dictionary key
# then set the name value for the Other Contact - Final Policy Lender
if other is not None:
if lender in mapping:
other.LookupCode = mapping[lender]