I would like to create an automation so that if the loan policy number field {{Order.Title.TitleInsuranceCalculations[1].LoanPolicy.Number}} on the Policy Schedule A screen is filled in, the {{Order.Title.TitleInsuranceCalculations.LoanPolicy.IssuedDate}} field will have the system date populate.
I can paste this formula into the Loan Policy issued date and it works.
If (not isempty ({{Order.Title.TitleInsuranceCalculations[1].LoanPolicy.Number}}) ) Then
Value = systemdate()
EndIf
I need help on converting this to a code snippet.
Please let me know if you can assist.
Thank you,
Bryan Thorson
Code Snippet for Loan Policy Number & Issued Date
-
- Posts: 1377
- Joined: Wed Jan 15, 2014 3:50 pm
- Location: Raleigh, NC
- Contact:
Re: Code Snippet for Loan Policy Number & Issued Date
Create a new Automation Process where "Every time" an order is saved and a "code snippet" evaluates to true then do the following: run "code snippet".
The first code snippet (Condition) returns True if the first loan policy doesn't have a number:And the second code snippet (Action) set the policy Number field:
The first code snippet (Condition) returns True if the first loan policy doesn't have a number:
Code: Select all
from System import *
from SoftPro.ClientModel import *
from SoftPro.Select.Client import *
def MyFunc():
# If there is no Loan Policy, return False
tic = Context.Title.TitleInsuranceCalculations[0]
if tic.LoanPolicy is None:
return False
# If the policy number is None or empty, return True
num = tic.LoanPolicy.Number
return num is None or len(num) == 0
MyFunc()
Code: Select all
from System import *
from SoftPro.ClientModel import *
from SoftPro.Select.Client import *
# No value in Loan Policy number. Set it to current date.
tic = Context.Title.TitleInsuranceCalculations[0]
tic.LoanPolicy.Number = str(DateTime.Today)
Bob Richards, Senior Software Developer, SoftPro
Re: Code Snippet for Loan Policy Number & Issued Date
Hello,
I also need this code snippet but I don't believe it does what it was intended to do. This process puts a date into the {{Order.Title.TitleInsuranceCalculations.LoanPolicy.Number}} field if that field is blank. I and the original poster were looking to add the date to the {{Order.Title.TitleInsuranceCalculations.LoanPolicy.IssuedDate}} field when the {{Order.Title.TitleInsuranceCalculations.LoanPolicy.Number}} field is populated for the first time.
Thank you
I also need this code snippet but I don't believe it does what it was intended to do. This process puts a date into the {{Order.Title.TitleInsuranceCalculations.LoanPolicy.Number}} field if that field is blank. I and the original poster were looking to add the date to the {{Order.Title.TitleInsuranceCalculations.LoanPolicy.IssuedDate}} field when the {{Order.Title.TitleInsuranceCalculations.LoanPolicy.Number}} field is populated for the first time.
Thank you
-
- Posts: 1377
- Joined: Wed Jan 15, 2014 3:50 pm
- Location: Raleigh, NC
- Contact:
Re: Code Snippet for Loan Policy Number & Issued Date
Here are the changes (I'm doing it from memory so you may have to tinker with it).
Condition
Action
Condition
Code: Select all
...
# If the policy issue date has never been set, return True
date = tic.LoanPolicy.IssuedDate
return date is None
...
Code: Select all
...
# Select dates are always UTC. Take today's day and convert it to UTC so it will display on UI as "12:00 AM".
tic.LoanPolicy.IssuedDate = DateTime.Now.Date.ToUniversalTime()
Bob Richards, Senior Software Developer, SoftPro