Answers.Body: <p>A field placed on the form will pick up a value (with same field name) passed by URL to the form, and the form itself can be configured to reference the current user. So to create a messaging function from a member directory, the recipient can be stored in a custom activity as target_contact, current user as source contact, and a CiviRule created to send an email to the recipient (which is triggered by the creation of the Activity) to alert them to the new message, to which they are directed using a separate Search Form online. This way, no email addresses are exposed.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-04-29T08:05:38.417Z
Answers.LastActivityDate: 2024-04-29T08:05:38.417Z
Answers.UserDisplayName: Simon Thornton-Wood
Body: <p>I have built a public Member Directory using Searchkit and Formbuilder (<a href="https://cgdent.uk/member-register/%5BMember" rel="nofollow noreferrer">https://cgdent.uk/member-register/[Member</a> Register]<a href="https://cgdent.uk/member-register/" rel="nofollow noreferrer">1</a>) and want to add a mailto-type link without exposing the member's preferred email address. (Separately, I will ensure &quot;opt-in&quot; for members who want this service). Is there a straightforward way to use SK/Afform to build this functionality?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-04-22T18:24:24.450Z
Comments.Text: You mean that you want to link to some type of webform that sends emails via CiviCRM to the member?
Comments.UserDisplayName: Coleman
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-04-23T08:20:35.143Z
Comments.Text: Yes, that's right.
Comments.UserDisplayName: Simon Thornton-Wood
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-04-23T17:20:09.487Z
Comments.Text: Well, your first step would be to create such a form on your site. Then you can link to it from the search display.
Comments.UserDisplayName: Coleman
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-04-25T08:39:39.430Z
Comments.Text: I can see how to create such a form (Submission form) which creates an Activity, and assign the Current User as the source of the Activity. I can see how to pass the Contact ID of the intended recipient to the form (...member-message/#?id=[id]) but not how to pick up that ID in the Activity.
  Creating an Email Activity does not send it, so I wonder if I should be creating a bespoke Activity and then generating an email triggered by the creation of the Activity?
Comments.UserDisplayName: Simon Thornton-Wood
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-04-25T14:32:19.260Z
Comments.Text: You can pick up the id by setting "Values" of the activity and choosing Contact 1 on the form.
  Bespoke activity + CiviRules or similar to send the email seems like a good way to go.
Comments.UserDisplayName: Coleman
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-04-26T11:28:50.653Z
Comments.Text: Thanks, but I'm struggling with that. I don't think I can use a variable as a set value in Formbuilder, and nor can I see how to place a variable on the form itself. Can you point me in the right direction?  Feels tantalisingly close if I can get past that!
Comments.UserDisplayName: Simon Thornton-Wood
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-04-27T14:28:18.500Z
Comments.Text: Solved! Thank you for your help. I had not appreciated that the form will pick up the value passed by URL if the field name matches a field that is placed on the form (and in this case, hidden)
Comments.UserDisplayName: Simon Thornton-Wood
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-04-28T21:17:56.687Z
Comments.Text: Simon, perhaps you would like to now add the Answer so SE knows this has been solved
Comments.UserDisplayName: petednz - fuzion
Tags: <searchkit><formbuilder>
Title: Public member directory (built with SK & Afform): can I inset a 'contact member' link?
ThreadText: # Public member directory (built with SK & Afform): can I inset a 'contact member' link?
  
  (Asked by: username_0 on 2024-04-22)
  
  I have built a public Member Directory using Searchkit and Formbuilder ([https://cgdent.uk/member-register/[Member](https://cgdent.uk/member-register/%5BMember) Register][1](https://cgdent.uk/member-register/)) and want to add a mailto-type link without exposing the member's preferred email address. (Separately, I will ensure "opt-in" for members who want this service). Is there a straightforward way to use SK/Afform to build this functionality?
  
  **Tags:** searchkit, formbuilder
  
  > **Comments:**
  > **username_1**: You mean that you want to link to some type of webform that sends emails via CiviCRM to the member?  
  > **username_0**: Yes, that's right.  
  > **username_1**: Well, your first step would be to create such a form on your site. Then you can link to it from the search display.  
  > **username_0**: I can see how to create such a form (Submission form) which creates an Activity, and assign the Current User as the source of the Activity. I can see how to pass the Contact ID of the intended recipient to the form (...member-message/#?id=[id]) but not how to pick up that ID in the Activity. Creating an Email Activity does not send it, so I wonder if I should be creating a bespoke Activity and then generating an email triggered by the creation of the Activity?  
  > **username_1**: You can pick up the id by setting "Values" of the activity and choosing Contact 1 on the form. Bespoke activity + CiviRules or similar to send the email seems like a good way to go.  
  > **username_0**: Thanks, but I'm struggling with that. I don't think I can use a variable as a set value in Formbuilder, and nor can I see how to place a variable on the form itself. Can you point me in the right direction?  Feels tantalisingly close if I can get past that!  
  > **username_0**: Solved! Thank you for your help. I had not appreciated that the form will pick up the value passed by URL if the field name matches a field that is placed on the form (and in this case, hidden)  
  > **username_2**: Simon, perhaps you would like to now add the Answer so SE knows this has been solved  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2024-04-29. Score: 1 | Accepted answer
  
  A field placed on the form will pick up a value (with same field name) passed by URL to the form, and the form itself can be configured to reference the current user. So to create a messaging function from a member directory, the recipient can be stored in a custom activity as target\_contact, current user as source contact, and a CiviRule created to send an email to the recipient (which is triggered by the creation of the Activity) to alert them to the new message, to which they are directed using a separate Search Form online. This way, no email addresses are exposed.
  
  
  ---
  
  