Jump to content
We've recently updated our Privacy Statement, available here. ×

Please help with adjusting a script to read from a column property to send an email notification


Luke Joseph

Recommended Posts

I am buiding a health analysis dashboard and want to automate email notifications based on when a column property changes.

I have the automation shared drive set up with an xml batch code and have tested it with a different dashboard (set up differently to send PDF reports)and returns the request.

The first attachment below (current script incorrect) is the script I am working with which also shows the syntax error.

The second attachment below (script for email send 2) shows the column references I am trying get the script to read from with the following points:

 

For the CheckSend column I have created an expression so the date due = max due date column 60 days will flag the report to trigger a send email notification which is in the CheckSend column.

When it triggers to send email it will read the value from the EmailBody column (I have created an expression to read as a notification).

I havent included the employee email address column yet but will do once I have this script correct.

 

I dont think I have the first part of the expression right as it keeps flagging a syntax error.

The third attachment below shows the expression I created to trigger "send email" from the "checkSend" column.

The column "EmailBody is where I have created a script to show the notification to be sent to each person based of the "send email' value (I cant show this one as itcontains confidential information with people's names).

All I am trying to do now is get the script to read the "CheckSend" column which will trigger the notification I created in the "EmailBody" column referencing that person, to be sent out.

The script I am working with:

If column CheckSend == "Send e-mail":

Get value from column EmailBody

Send email

 

import clr

clr.Addreference("Microsoft.Office.Interop.Outlook")

from System.Runtime.interopServices import Marshal

 

mail= Marshal.GetActiveObject("Outlook.Application").CreateItem(0)

 

mail.Recipients.Add(Email of employee)

 

mail.Subject = "Subject of email"

mail.Body = Document.Properties["EmailBody"]

mail.Send();

 

Any help is greatly appreciated.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...