I'm trying to get the settlement date to appear in an email rendered via automation, but I'm getting an error. Any idea what the correct format would be?
Also, how can I get the format of the text to match the rest of the text?
Thank you!
Code snippet:
Code: Select all
from System import *
import clr
clr.AddReference('System.Net.Http')
from System.Net.Http import HttpClient, StringContent
from System.Text import Encoding
clr.AddReference('System.Web.Extensions')
from System.Web.Script.Serialization import JavaScriptSerializer
from SoftPro.ClientModel import *
from SoftPro.Select.Client import *
def SendEmail(fromAddress, toAddress):
email = {
'to': toAddress,
'from': fromAddress,
'body': '<hl>Settlement Date has been added/updated in the file to </hl><pre>' + Context.SettlementDate + ' .',
# + JavaScriptSerializer().Serialize(Context.FileHeld.HeldByUser)
'subject': 'Settlement Date update for ' + Context.EmailSubjectLine
}
js = JavaScriptSerializer()
params = js.Serialize(email)
content = StringContent(params, Encoding.UTF8, 'application/json')
client = HttpClient()
response = client.PostAsync('http://sharedapi.madisoncres.com/functions/email', content).Result
print(response)
for contact in Context.Contacts:
if hasattr(contact, 'OtherType') and contact.OtherType == 'Funder':
if contact.Email:
SendEmail('selectnotifications@madisoncres.com', contact.Email)
if Context.FileHeld.HeldByUser.EmailAddress:
SendEmail('selectnotifications@madisoncres.com', Context.FileHeld.HeldByUser.EmailAddress)