I am creating a Code Snippet that needs to check the value of a Custom Field, which I have added to several of the Order Contact Types. However, the editor is interpreting the "#" as the start of a comment rather than the balance of the code.
from System import *
from SoftPro.ClientModel import *
from SoftPro.Select.Client import *
from SoftPro.OrderTracking.Client.Orders import *
def CreateTask
#Return True if PreTSG Task exists or (TypingTSG exists and the Order is not for a Pre-Tsg Servicer)
isPreTSG = False # Defaulted to False
if (any(c.Flueid_PreTSGServicer## == True for c in Order.Contacts)):
isPreTSG = True # Set to True when one of the Contact has the Pre-TSG Servicer Flag set to True.
# Return True if the Task Code is Not Empty and is either PreTSG or (TypingTSG and Not a Pre-TSG Servicer Order)
If any((task.Code is not None and (task.Code.lower() == 'pretsg' or (task.Code.lower() == 'typingtsg' and isPreTSG == False))) for task in Context.Tasks):
Return True
CreateTask()
What do I need to change to get the custom field recognized as a field rather than a comment?
Any help in resolving this issue would be greatly appreciated.
Ok, I made advancements on how to incorporate a custom field, however now I am running into an issue using the overall Context "Contacts" as opposed to a specific Context like "MortgageBrokers". I suspect this is because the custom field has not been defined on every Contact Type, but there are 10 of them that do which is why I am trying to use the overall Context of "Contacts". How can I use "Contacts" and condition against those Contact Types that do not include the Custom Field.
from System import *
from SoftPro.ClientModel import *
from SoftPro.Select.Client import *
from SoftPro.OrderTracking.Client.Orders import *
def AddTask():
isPreTSGServicer = False
#for con in Context.MortgageBrokers: #Works when I use this, as the Custom Field has been defined on the MortgageBrokers Context.
for con in Context.Contacts: #Errors Out when I use "Contacts". I suspect this is because Not All Contacts have the Custom Fields.
PreTSGServicer = IOrderItem.GetProperty(con, 'PreTSGServicer##')
if PreTSGServicer is not None and PreTSGServicer == True:
isPreTSGServicer = True
if any((task.Code.lower() == 'pretsg' or (task.Code.lower() == 'typingtsg' and isPreTSGServicer == False)) for task in Context.Tasks):
return True
AddTask()
for con in Context.Contacts:
if IOrderItem.HasProperty(con, 'PreTSGServicer##'): # Does this contact have the custom propery?
# Yes - it does.
PreTSGServicer = IOrderItem.GetProperty(con, 'PreTSGServicer##')
We use this frequently if we don't know the specific object type we are passed.