CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Post-installation Setup and Configuration (Moderator: Dave Greenberg) »
  • Automated email to be sent upon joining a group?
Pages: [1] 2

Author Topic: Automated email to be sent upon joining a group?  (Read 2478 times)

narragansett

  • I post occasionally
  • **
  • Posts: 47
  • Karma: 2
  • CiviCRM version: 3.3.5
  • CMS version: Drupal 6.20
  • MySQL version: 5.1.41
  • PHP version: 5.3.2-1
Automated email to be sent upon joining a group?
October 21, 2011, 06:20:56 am
I've set up a Drupal webform for my users, and I want them to receive a custom-formatted email when they click the "Submit" button.  I haven't been able to get the built-in email functionality within webform to include all the user info (from the Civi database) that I'd like, but I can automatically add the user to a Civi group.

Is it possible to send an email to new members of a group from within Civi?  If yes, how?  I've seen references to this functionality, but I cannot find instructions for how to do so.  Any pointer in the right direction will be much appreciated   :)

Thanks!

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: Automated email to be sent upon joining a group?
October 21, 2011, 11:47:07 am
Are you using the Webform-CiviCRM integration module - or just standard Webform?
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

narragansett

  • I post occasionally
  • **
  • Posts: 47
  • Karma: 2
  • CiviCRM version: 3.3.5
  • CMS version: Drupal 6.20
  • MySQL version: 5.1.41
  • PHP version: 5.3.2-1
Re: Automated email to be sent upon joining a group?
October 21, 2011, 12:59:56 pm
Quote from: petednz on October 21, 2011, 11:47:07 am
Are you using the Webform-CiviCRM integration module - or just standard Webform?

I am using the Webform-CiviCRM integration module, i.e. I have access to Civi data within Webform...

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: Automated email to be sent upon joining a group?
October 21, 2011, 01:25:13 pm
You might want to see if you can get what you need by using Rules.
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

narragansett

  • I post occasionally
  • **
  • Posts: 47
  • Karma: 2
  • CiviCRM version: 3.3.5
  • CMS version: Drupal 6.20
  • MySQL version: 5.1.41
  • PHP version: 5.3.2-1
Re: Automated email to be sent upon joining a group?
October 22, 2011, 08:54:10 am
Pete-

I don't see how Rules will help me, though I suspect that is because my question didn't define clearly enough what I need to do.  Let me try again...

1)  Our organization requires a liability waiver be physically signed & kept on file each year, for each member.  This is currently done by sending this waiver as a part of our monthly newsletter, with the member handwriting some personal info into the top of the form, then signing & dating the waiver at the bottom.  We have in the past used this personal info to keep our membership "database" (i.e. Excel spreadsheet) up to date.

2)  Now that we've converted this old "database" into CiviCRM, all members who have created log in accounts to our web site are able to update their contact & personal info online.  I am using a Webform pre-populated with the user's Civi info to allow them to confirm &/or update this info online, eliminating the need to handwrite that info on the paper form.  However, we still require a physically signed waiver, so my goal is to get this waiver to them via email upon submission of the Webform.

3)  The waiver users will print & sign needs to have some personally identifying info from the Civi database included in it, and how best to make this happen is what I am having problems figuring out.

My original question was a (poorly worded) attempt to find out how I can get Civi to generate an email when a user joins a specified group.  My reasoning is that I know how to automatically register a user into a given Civi group upon submission of a Webform, but I don't know how to get Civi to send that user an email upon registration into that group.  I figured sending an email from within Civi would be easiest, as I know how to get Civi data into an email generated by Civi.

If generating an email from within Civi is either not possible, or is not the easiest / best solution, I am certainly open to other solutions as well.  For example, I know how to generate an email from within Webform upon submission of a webform, but I don't know how to pull Civi data into that email.  I've tried, but I haven't a clue how to properly format a token to get the Civi data to appear.

My ideal solution would be to have something like a .pdf document with the waiver and all the necessary Civi data be sent as an attachment to the user upon submission of the webform.  This would allow me to ensure that each user printed a single page to be mailed in, which I cannot guarantee if the waiver is included as the body of an email.  However, unless there is a pre-built way to do this someone can point me to, I certainly don't expect you or anyone else to try & figure out how to make this work.  I include this paragraph simply to illustrate what I see as the ideal solution from the user's perspective - I'll use the solution which gets me as close to this ideal as possible.

Hopefully this clarifies what I am looking for.  If the Rules module somehow helps me to bring Civi data into an email, or a document / web page which can be emailed, please point me toward some instructions I can follow to make this happen.  As I mentioned, I looked at all the tutorials found through the Drupal Rules module home page, but I saw nothing related to CiviCRM included there...

Finally, if you see some other solution that I haven't mentioned, I am "all ears".  I simply need to make this work, and don't care so much how at this point - this is supposed to be available to the users no later than 11/1/11, and I'm rapidly running out of time to test & implement solutions.

I really appreciate any / all help & advice you, or anyone else who has any insight into this issue might have.

Thank you very much.

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: Automated email to be sent upon joining a group?
October 22, 2011, 08:45:01 pm
My thinking was along these lines
Webform can push an email to the user with all the details from the form, including any info it has pulled in from civi.
I thought that if you were needing another email to go, with your 'sign and send back' instructions, then you should be able to construct a Rule that will say 'when action X happens in Webform' (ie the form gets submitted) then do Y (ie fire off an email and/or PDF using the data that webform has already sucked from CiviCRM).
But it doesn't sound like I am being very helpful so hopefully someone else will come along with some other suggestions. I don't know how to approach what you want directly via CiviCRM, sorry.
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: Automated email to be sent upon joining a group?
October 22, 2011, 09:02:53 pm
Another thought.
if you use the webform-civicrm to create an 'Activity' and set it to be assigned to the user - then they get a nicely formatted email with all the fields.
You might find a way to get an extra 'blank' field in that (by not including it in the webform but including as an Activity Custom field) so that it appears at the bottom of the email with a 'Sign and Post back' label.
Dang - sorry (again) just checked and don't see an option to set the 'user' as the 'assignee' of the Activity.
Just pinged coleman to see if it might be an easy/useful option. Will come back on this if I hear back from him.
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: Automated email to be sent upon joining a group?
October 22, 2011, 09:37:46 pm
My bad - i overlooked the obvious - yes you can use the webform- civicrm Activity setting to Assign to the person filling in the form (ie Contact 1)

So not sure if this is going to help you but one recipe is
- create new Activity Type
- add custom data group for above Activity Type
- add a custom field to above data group called 'Please sign and return'
- on the webform set the CiviCRM settings to make an Activity of the above type and set it to be Assigned to 'webform contacts' 'Contact1'
- add any other settings such as whether the activity should be set to Pending so you can then find all those that haven't been signed and chase them up
- set the field to show in Webform but make it disabled and add any extra instructions you may to explain that this field is for signing and returning - eg "You will be emailed a copy of this form. You must sign and return this. (you can not fill this field in on this web page)"
- set the field on webform to be 'disabled' so they can't put anything in it

Outcome
- Activity is added to Contact1 CiviCRM record and they got a nicely formatted email of all the data they just filled in, including the (last) field which says 'Please sign and return"

Does that sound like it is getting closer to something that would help.
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

Coleman Watts

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 2346
  • Karma: 183
  • CiviCRM version: The Bleeding Edge
  • CMS version: Various
Re: Automated email to be sent upon joining a group?
October 22, 2011, 09:41:54 pm
Yes, you can assign an activity to the current user, just "choose assignee from:" "webform contacts" and pick "contact 1"

With a tiny bit of fudging (see the webform_civicrm readme), you can make any field "hidden" on the form, with whatever value you want. (a step up from making it disabled). So the field will get populated, but the user won't see it on the form, just in the email.
Try asking your question on the new CiviCRM help site.

Coleman Watts

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 2346
  • Karma: 183
  • CiviCRM version: The Bleeding Edge
  • CMS version: Various
Re: Automated email to be sent upon joining a group?
October 22, 2011, 09:51:25 pm
Just read your scenario a bit more thoroughly. As I understand it:

1) You want the user to fill-in/update certain info about themselves on the form.
2) You then want to send them an email generated by webform module (this is probably best -- more flexible then Civi's assignee email) which contains information about them. You probably already know that any of the above fields from step 1 can easily be included in that email via webform's tokens.
3) I'm assuming that your problem is that you want to include some more info about the person in the email that wasn't part of the form. This is where the "hidden field" trick can come in handy.

I think you can achieve step 3 by the following:
- From the CiviCRM tab, enable the field you want
- Go to edit that webform field, and note the field key (something like civicrm_1_contact_1_some_field) and copy it to your clipboard.
- Delete the field from the webform. You didn't want it on the form, just in the email.
- Create a new webform field of type "hidden." Give it any name you want.
- Give it the exact same field key as the one you just deleted.
- Viola! The field will not be shown to the user on the form, but webform_civicrm will populate it, so it will be available to your email as a token, just like the visible fields.
« Last Edit: October 22, 2011, 09:53:20 pm by colemanw »
Try asking your question on the new CiviCRM help site.

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: Automated email to be sent upon joining a group?
October 22, 2011, 10:01:38 pm
Thanks for explaining the 'hidden' trick - i didn't pick that up in the ReadMe though it clearly says
"You can, for example, create your own webform element of a custom type, give it the appropriate form key and it will be linked to that civicrm field."
Just I hadn't recalled that Webform has its own 'hidden' field type - sweet
Confirmed it worked in terms of adding that field to the Activity email - but as you say, that isn't the most appropriate of emails since it has 'activity' related fields in it.
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

narragansett

  • I post occasionally
  • **
  • Posts: 47
  • Karma: 2
  • CiviCRM version: 3.3.5
  • CMS version: Drupal 6.20
  • MySQL version: 5.1.41
  • PHP version: 5.3.2-1
Re: Automated email to be sent upon joining a group?
October 23, 2011, 09:37:14 am
Quote from: colemanw on October 22, 2011, 09:51:25 pm
Just read your scenario a bit more thoroughly. As I understand it:

1) You want the user to fill-in/update certain info about themselves on the form.

Yup


Quote
2) You then want to send them an email generated by webform module (this is probably best -- more flexible then Civi's assignee email) which contains information about them. You probably already know that any of the above fields from step 1 can easily be included in that email via webform's tokens.

I am aware this is possible, but I cannot for the life of me figure out how to do it.  I see the following instructions under "Token Values" in the "Edit Email Settings" area:

  • Special tokens
    %profile[key] - Any user profile field or value, such as %profile[name] or %profile[profile_first_name]
    %get[key] - Tokens may be populated from the URL by creating URLs of the form http://example.com/my-form?foo=bar. Using the token %get[foo] would print "bar".

    In addition to %get, the following super tokens may be used, though only with logged-in users: %server, %cookie, %request and %post. For example %server[HTTP_USER_AGENT] or %session[id].

My assumption is / was that I could use the "%profile[key]" format to insert any info from the Civi database into the email in any position I'd like, but I clearly have no clue how to properly format that quoted string of characters in order to make the correct info appear.

For example, in the old, hand-written version of the form, the Waiver begins with the standard:

  • "I, _______________________ (insert full name), being of lawful age, in consideration of being permitted to participate in..."

I'd like to have the user's first, middle & last names appear already printed where that line is in the email they are to print & send in, but none of the following work (first name used as example):

  • %profile[first name]
  • %profile[first_name]
  • %profile[civicrm_first_name]
  • %civicrm[first name]
  • %civicrm[first_name]
  • %civicrm[civicrm_first_name]

This is my major stumbling block right now, and I need to figure out how make it work.  I assume it is supposed to be obvious since I cannot find any instructions for how to do it anywhere - either that or the instructions are out there and my search skills are seriously lacking.  I wouldn't be surprise by either...

What is the proper format to allow me to pull in data from the Civi database?

Quote
3) I'm assuming that your problem is that you want to include some more info about the person in the email that wasn't part of the form.<snip>

I don't actually need to insert any data into the email that is not in the webform.  Though I suspect your instructions for how to do so will prove to be invaluable in the future, so thank you very much for including them!   :)

Coleman Watts

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 2346
  • Karma: 183
  • CiviCRM version: The Bleeding Edge
  • CMS version: Various
Re: Automated email to be sent upon joining a group?
October 23, 2011, 11:08:31 am
Profile tokens refer to the drupal profile module, not civicrm profiles. The webform integration module does not pull data from civicrm to populate tokens. Although that is a nice idea, perhaps a sponsor will step up to make that happen.

What you want are submission tokens, to get the values that were just submitted on the form. A bit farther down on the page you quoted, it says:
%value[key] - A value without additional formatting. Elements may be accessed such as %value[fieldset_a][key_b]. Do not include quotes.

Click the "edit" button on a form element to get the form key.

So if your contact is in a civi-integration-generated fieldset, first name would be:
%value[civicrm_1_contact_1_fieldset_fieldset][civicrm_1_contact_1_contact_first_name]
Try asking your question on the new CiviCRM help site.

narragansett

  • I post occasionally
  • **
  • Posts: 47
  • Karma: 2
  • CiviCRM version: 3.3.5
  • CMS version: Drupal 6.20
  • MySQL version: 5.1.41
  • PHP version: 5.3.2-1
Re: Automated email to be sent upon joining a group?
October 23, 2011, 11:31:37 am
Quote from: colemanw on October 23, 2011, 11:08:31 am
Profile tokens refer to the drupal profile module, not civicrm profiles. The webform integration module does not pull data from civicrm to populate tokens. Although that is a nice idea, perhaps a sponsor will step up to make that happen.

What you want are submission tokens, to get the values that were just submitted on the form. A bit farther down on the page you quoted, it says:
%value[key] - A value without additional formatting. Elements may be accessed such as %value[fieldset_a][key_b]. Do not include quotes.

Click the "edit" button on a form element to get the form key.

So if your contact is in a civi-integration-generated fieldset, first name would be:
%value[civicrm_1_contact_1_fieldset_fieldset][civicrm_1_contact_1_contact_first_name]

Well no wonder I was having problems...   :)

So, I clicked on the "edit" button for the "First Name" form element and the key is "civicrm_first_name".  I put that into the second bracketed area, tested it, and get the following output in the resulting email:

"%value[civicrm_1_contact_1_fieldset_fieldset][civicrm_first_name]"

I am assuming that [civicrm_first_name] is the correct substitution for [key_b], but that I need to change the [fieldset_a] entry?

I apologize for my near complete lack of understanding regarding how to do this.  I know it isn't your job to hold my hand through this process, but asking the question is the only thing I can do at this point.  Anything else is just blindly typing, in the hope that I eventually get it right by pure luck...

Thank you very much for the time you've spent on this so far, and for any time you are willing to spend to help me resolve it...

Coleman Watts

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 2346
  • Karma: 183
  • CiviCRM version: The Bleeding Edge
  • CMS version: Various
Re: Automated email to be sent upon joining a group?
October 23, 2011, 01:33:12 pm
If the field is not inside a fieldset, you don't need the first bracket. You would just use
%value[civicrm_first_name]

If the field is inside a fieldset, click the edit button and get the key of that fieldset and put it in the first bracket, like the example says. The webform module lets you create as many fieldsets as you want, and even put them inside each other, so to get a value from a field inside a fieldset that's inside another fieldset, use:
%value[key_of_outer_set][key_of_inner_set][key_of_your_field]

However, you are using version 1 of the webform_civicrm module, so before you go any farther, I suggest you download the latest 2.x-dev version and run update.php. This will save you the trouble of having to alter these tokens in the future. After you upgrade, the correct token will be:
%value[civicrm_1_contact_1_contact_first_name]
(unless it is inside a fieldset, see above.)
Try asking your question on the new CiviCRM help site.

Pages: [1] 2
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Post-installation Setup and Configuration (Moderator: Dave Greenberg) »
  • Automated email to be sent upon joining a group?

This forum was archived on 2017-11-26.