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 (Moderator: Dave Greenberg) »
  • Linking to event application in CiviCRM contact record using webform_civicrm
Pages: [1]

Author Topic: Linking to event application in CiviCRM contact record using webform_civicrm  (Read 1039 times)

curious-trick

  • I’m new here
  • *
  • Posts: 29
  • Karma: 0
Linking to event application in CiviCRM contact record using webform_civicrm
November 14, 2013, 08:10:03 pm
(Figured out a workaround for something I've wandered about for a while -- part of this thread I started 3 years ago http://forum.civicrm.org/index.php/topic,14431.msg101568.html, and drawing on this blog post and comments: https://civicrm.org/blogs/petednz/hashed-links-webform-civiforms-solution-collection-organisation-details-event)

Curious if anyone has other ways to do this.

Use case: (Drupal 7 + CiviCRM 4.2) Event participants fill out a multi-page application, and I want to see that info, or at least a link to it, on their CiviCRM contact record. The application includes data that I don't want in their CiviCRM contact profiles -- I don't want it there because:
  • not all contacts need that data
  • making a contact subtype for each event would mean a contact could only hold the data for one event
  • adding the fields as a CiviCRM profile is kind of tedious compared to webform (maybe this is just my preference.
How to make a link to the contact's form submission appear on their contact record, using a CiviCRM training course as the example, using Drupal, Webform, CiviCRM, and webform_civicrm:
  • Civi > Administer > Customize Data and Screens > Custom Fields: create a custom field set named "Links to Forms" for the contact type, and create a field in it of type link, named "Link to CiviCRM Training Application".
  • Create a webform "Application Info Review". For our example, we'll say it's node/39.
  • Enable civicrm fields in civicrm tab of form.
  • Enable first and last name.
  • Enable the the field just created (bottom of list) and check the box to turn it on.
  • Create another webform, "CiviCRM Training Application". For our example, we'll say it's node/40.
  • Enable civicrm fields in civicrm tab of form.
  • Enable contact ID and checksum for contact 1.
  • Enable whatever other fields you want on the event application, maybe first and last name, phone, and email.
  • In the Form settings subsection of the Webform tab, set Redirection location to Custom URL, and point it to the first webform, using tokens to include the form submission ID as %sid and the contact ID and checksum for contact one. Note that tokens require the URL be written relative to the Drupal site root, so our URL looks like this: node/39?sid=%sid&cid=%value[civicrm_1_contact_1_fieldset_fieldset][civicrm_1_contact_1_contact_contact_id]&cs=%value[civicrm_1_contact_1_fieldset_fieldset][civicrm_1_contact_1_contact_cs]
  • Return to  "Application Info Review" webform.
  • In order to make it draw the %sid and put it into the contact's custom field created earlier, edit the form component for the link:
  • In the default value box, put http://www.example.com/node/40/submission/%get[sid]
  • And in the Display section, turn on Disabled ("Make this field non-editable. Useful for setting an unchangeable default value.")
  • Optional: Also in the Display section, turn on Private to make the URL invisible to users who don't have access to view form results.
  • Now that we have the application webform directing users to the review webform, and passing along the submission ID and contact ID and checksum; and the review webform taking the submission ID and storing it in the contact's CiviCRM record, it's time to test!
Maybe a lot of steps, and almost all have to be repeated for each new event (the only difference is that I don't have to recreate the custom fieldset Links to Forms), but it's the only way to do this that I've figured out with my skill set (no PHP coding). Without this, the applications aren't directly accessible from the contact record, and that makes for more fishing around than desired. Maybe a future version of webform_civicrm could make this workaround obsolete by including a list of form submissions made by the contact on the contact record.

What do you think? Is this useful for you?

curious-trick

  • I’m new here
  • *
  • Posts: 29
  • Karma: 0
Re: Linking to event application in CiviCRM contact record using webform_civicrm
November 14, 2013, 08:21:58 pm
That example assumes that the custom fieldset is set to "Use for: Contacts" and "Does this Custom Field Set allow multiple records?" is turned off. That's off because if turned on, it would limit a bunch of uses of the data, including making Display Style: Inline unavailable [1], and the whole point of this is to display a link to the forms on the main view of the contact record. Also for that purpose, "Collapse this set on initial display" is turned off.

However, if I was okay with Display Style: Tab and the other limitations, then I could turn on the multiple records option, and wouldn't have to create a new custom field for each form -- but then the links to the forms wouldn't be named, there'd just be a list of non-descriptive URLs like http://www.example.com/node/40/submission/57 (and URL aliases don't work with webform, so http://www.example.com/application-form/submission/57 doesn't work).

[1] according to the Multiple records section on this page http://book.civicrm.org/user/current/organising-your-data/custom-fields/

Coleman Watts

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 2346
  • Karma: 183
  • CiviCRM version: The Bleeding Edge
  • CMS version: Various
Re: Linking to event application in CiviCRM contact record using webform_civicrm
November 14, 2013, 08:24:48 pm
That's a good trick, but like you said a lot of steps.
The "out-of-the-box" solution provided by webform_civicrm is to use activities - it can put a link to the webform submission in the activity body. It can also put the entire contents of the submission into the activity.
I assume you didn't like that solution because it doesn't show up on the main contact summary tab?
Try asking your question on the new CiviCRM help site.

curious-trick

  • I’m new here
  • *
  • Posts: 29
  • Karma: 0
Re: Linking to event application in CiviCRM contact record using webform_civicrm
November 14, 2013, 08:31:31 pm
Quote from: Coleman Watts on November 14, 2013, 08:24:48 pm
The "out-of-the-box" solution provided by webform_civicrm is to use activities - it can put a link to the webform submission in the activity body. It can also put the entire contents of the submission into the activity.
I assume you didn't like that solution because it doesn't show up on the main contact summary tab?
I didn't try that because I've never used activities, so know nothing about them, and it didn't occur to me. If doing it that way would be a lot easier, then I might settle for having it in another tab. Any pointers to directions about linking webforms to activities? Or I can just poke around if not.

Also, right now I have webform 7.x-3.18 and webform_civicrm 7.x-3.4 -- I see both could be updated to 4, don't know if that would make any difference.

Coleman Watts

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 2346
  • Karma: 183
  • CiviCRM version: The Bleeding Edge
  • CMS version: Various
Re: Linking to event application in CiviCRM contact record using webform_civicrm
November 14, 2013, 09:08:15 pm
It's pretty simple. On the CiviCRM tab of your webform, click the "Activity" section, choose an activity type and an activity will be logged every time the form is submitted. You can see the checkboxes in that section that control whether the link or the entire submission are included in the activity.
This works in any version. Although upgrading to the latest version of webform_civicrm 3 is advisable.
If you want to upgrade Webform and Webform-CiviCRM to version 4 (with cool new but unrelated features) you also need to be running CiviCRM 4.4.
Try asking your question on the new CiviCRM help site.

curious-trick

  • I’m new here
  • *
  • Posts: 29
  • Karma: 0
Re: Linking to event application in CiviCRM contact record using webform_civicrm
November 15, 2013, 08:58:26 pm
Cool, I like the CiviCRM Activity integration. I haven't dived into it enough to really understand CiviCase and Activities, but I made a new Activity type, "Application", and that's good enough for me for now. Thanks!

Also, I upgraded to Civi 4.4, Webform 4, and Webform CiviCRM 4. What are the chances of getting a form_builder related UI compatible with webform_civicrm (I see that form_builder_webform isn't)?

As part of the upgrade to Webform 4, the token syntax changed, and the lines I first mentioned were automatically changed to this on the application form:
node/39?sid=[submission:sid]&cid=[submission:values:civicrm_1_contact_1_fieldset_fieldset:civicrm_1_contact_1_contact_contact_id:nolabel]&cs=[submission:values:civicrm_1_contact_1_fieldset_fieldset:civicrm_1_contact_1_contact_cs:nolabel]

and in the confirmation form:
http://www.example.com/node/38/submission/[current-page:query:sid]
« Last Edit: November 15, 2013, 09:00:25 pm by curious-trick »

Coleman Watts

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 2346
  • Karma: 183
  • CiviCRM version: The Bleeding Edge
  • CMS version: Various
Re: Linking to event application in CiviCRM contact record using webform_civicrm
November 17, 2013, 07:26:50 pm
Since an activity is simply "a record that something happened" it's a natural fit for logging webform submissions.

Quote
What are the chances of getting a form_builder related UI compatible with webform_civicrm
Well, it only takes time and money to write software :). Not sure if anyone will sponsor that work though, since it would add slick-ness but no new functionality.
Try asking your question on the new CiviCRM help site.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM (Moderator: Dave Greenberg) »
  • Linking to event application in CiviCRM contact record using webform_civicrm

This forum was archived on 2017-11-26.