Generate/send email when a feature is added to a hosted service

Jump to solution
02-24-2015 09:47 AM
New Contributor III

Is it possible to have an email sent (to a list of recipients) whenever a point is added to a hosted File GDB on a public web-app?


The idea is to originate a permit application process from a web-map/app: applicants can add a point for the location they need a permit for, enter their information and apply for a permit (of particular kind). An email alerts officials that a permit has been applied for. The rest of the approval process flow from there and the hosted data is used to collect applicant information (including location for permit) as well as flag the status of the application as it makes its way through various stages of the approval process.


Any ideas on how to have edits trigger emails?

67 Replies
New Contributor III

Of course. 🙂

That app doesn't fully address our needs though (rather, it has bells and whistles we may not want to pay for) so I'd like to see what other closer solutions exist. Right now, I've only tried out the free ESRI apps that i get when I go to make an app from a web-map in AGOL...was wondering if there are others like that anywhere else.

I take it that's it for freeware?

Will definitely do the free trial as you suggest. The annual cost might still be more cost-efficient than contracting out for a solution (since we don't have much app development skills in-house).

0 Kudos
New Contributor II

What is the format for crafting a query with your script.  Say I had a field named STATUS and a field named TYPE and I wanted to query records where:  [TYPE] = 'POTHOLE' and [STATUS] = 'OPEN'  

I have tried various combinations like below but have had no luck.  Is there any chance anyone has done this before and could help.  Thanks!!

params = {'f': 'pjson', 'where': "1=1 and 'REQUEST_TYPE' = 'PW (SM)-Potholes'", 'outfields' : 'OBJECTID, created_date, SUMMARY, ADDRESS1', 'returnGeometry' : 'false'}

0 Kudos
by Anonymous User
Not applicable

If you haven't figured this this out already the correct syntax should be:

params = {'f': 'pjson', 'where': "(REQUEST_TYPE)='PW (SM)-Potholes'", 'outfields' : '*', 'returnGeometry' : 'false'}

Hope that helps

0 Kudos
New Contributor II

Check!  I actually figured it out by hitting the query web page and trying various combinations but thank you very much for your answer!

0 Kudos
New Contributor II

This is not really related to the python part, but I would still like to suggest using the GeoEvent Server, with the input connector "Poll an ArcGIS Server For Features".

It can be configured with queries, e.g. to only get the rows with something like a "MissingPermit" status set and then update that status when the email has been sent (GeoEvent Server can send emails too with en output connector).

Esri Esteemed Contributor

I would agree with Daniel Hjorth Christensen‌.  The best and easiest approach would be to use GeoEvent Server.  The following help document for the Citizen Problem Notification app discusses the steps to set this up:

Real-time Problem Notifications - Citizen Problem Reporter | ArcGIS for Local Government 

Occasional Contributor II

Definitely agree with both Daniel Hjorth Christensen and Jake Skinner, however, the GeoEvent Processor is a very expensive option for many Org's, esp compared to writing some python and scheduling a task to accomplish nearly the same task.

New Contributor III

We're starting to use the Crowdsource platform for citizen requests, but many of the employees where I work are used to receiving emails when a citizen request comes in. I tried using this script to do this, but I'm receiving an error message that I'm unsure of what it means or how to fix it.

Error message:

Traceback (most recent call last):
File "C:\Users\james\Desktop\Pothole", line 33, in <module>
smtpObj.sendmail(FROM, TO, message)
File "C:\Python27\ArcGIS10.5\lib\", line 735, in sendmail
File "C:\Python27\ArcGIS10.5\lib\", line 469, in rset
return self.docmd("rset")
File "C:\Python27\ArcGIS10.5\lib\", line 394, in docmd
return self.getreply()
File "C:\Python27\ArcGIS10.5\lib\", line 368, in getreply
raise SMTPServerDisconnected("Connection unexpectedly closed")
SMTPServerDisconnected: Connection unexpectedly closed

Any suggestions? Thank you!

0 Kudos