Hello,
I am attempting to use a "Note" question to create a hyperlink to launch an email containing information from my Survey123 form that was built within Survey123 Connect v2.0.35.
I have a set of 6 questions that pertain to project details that I am having our project managers fill out through the Survey123 app. I have a text question that is set to multi-line that contains some text and also pulls in the answers to the 6 questions to create what will be the body text of the email (please see below).
"Hello GIS Department," + "\n"+ "\n"+"This is a request to set up a new GIS application with the following information below:" + "\n"+ "\n" + "Project Number: " + ${ProjectNumber} +"\n" + "Project Name: " + ${ProjectName}+"\n" + "Site Name: " + ${SiteName}+"\n" + "Company Name: " + ${CompanyName}+"\n" + "ESI Project Lead: " + ${ESI_ProjectLead} +"\n" + "ESI Field Lead: " + ${ESI_Field_Lead} + "\n" + "\n"+ "Thanks"
Next I have a "Note" question that has a calculation to pull together the hyperlink text that is needed to launch an email and then allow the user to send off the email. That works perfectly (see below).
concat('<a href="mailto:',${Email_Name},'?subject=GIS App Setup&body=',${Email_Body_Text},'">Link to email info</a>')
Next, I want the user to submit the survey form, but this is where things hang up. I receive an error code 1000 "String or binary data would be truncated. The statement has been terminated."
Can anyone provide some insight on what this error means and how to get around the error to allow the survey to be submitted?
I would greatly appreciate any help or insight.
Thank you in advance,
Mike
Solved! Go to Solution.
Thanks for sharing your workflows. Does anyone know if there is a way to add information collected in the survey into the subject line? I tried adding it directly into the calculation for the "Send Email Request Text", and I also tried creating another field similar to the Send Email Body. The calculation works correctly in the app but once the email is launched, the subject line reads as "/'form name'/'field name'" instead of what was calculated for that field.
Hilary,
I wonder if you could use this variant?
You need to revise the concat() function a little bit; not sure if the screen shot will come through. I would post the entire line together, but then some HTML will be displayed. if you take the hard return out and combine the 2 sentences together, then you will have the code that I think should work for what you want. The ${SendEmailRequestText} represents the value of the field or other information that you want to pass along. The biggest thing was to update the concat() function to create the proper hyperlink format to pass the information into the new email.
concat('<a href="mailto:mbruening@envsi.com;ckemmerer@envsi.com?&cc=',${EmailNamePass},
'&subject=',${SendEmailRequestText},'&body=',${Email_Body_Text},'">Link to email info</a>'
Cheers!
Mike
Does this work if you have an if yes statement email to?
Trisha,
I am unsure of what you are asking? Do you mean to control the "visibility" of the link for the email note by an "if statement"? If so, then I think you would be able to setup a relevant statement that requires a certain field to be filled out before showing the email link.
If you are looking for an automated email function based on the answer of a question, then I am unsure if that is possible? Maybe through a java pulldata function? The only other way that I know of is through using a web hook, but that can only be used within the initial submittal of the survey.
yes, automated email function based on the answer of a question - I was looking for an “if statement” (relevant statement) that if selected yes (for example) would automatically send the email without it opening up the email and having to hit send. Specifically for if a user is using off-line, it will sit in outbox until user is able to get back on-line.
Thank you!
Trisha,
If this will be a one time submittal of the survey form, then I would look into the use of Webhooks. Here is a list of articles that the Survey123 team has put together; read through the comments as there are helpful tips within them.
Webhooks—Survey123 for ArcGIS | ArcGIS
This method will only work if the survey is being submitted once, as the Survey123 team has not opened the use of webhooks through multiple submittals. I am sure they are devising a way for using webhooks from the Inbox and Draft folders though. This method will also work while users are collecting the data in an offline mode and then submitting once they have connectivity.
Good Luck!
This is a great workaround for the email or notify feature.I'll definitely use this. Thanks for sharing your xlsform.
You're Welcome!
Just remember to switch out my email addresses for yours; otherwise I could receive a lot of emails. Lol
I just wanted to thank you Mike. You are awesome.
Thanks Mike for sharing. Love this functionality