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) »
  • Discussion »
  • Extensions »
  • CiviVolunteer (Moderators: GinkgoFJG, Michael Z Daryabeygi) »
  • How to get Volunteer Role as email token
Pages: [1]

Author Topic: How to get Volunteer Role as email token  (Read 729 times)

naheedmk

  • I’m new here
  • *
  • Posts: 5
  • Karma: 0
  • CiviCRM version: 4.5
  • CMS version: Joomla 3.3
  • MySQL version: 5.6.20
  • PHP version: 5.5.15
How to get Volunteer Role as email token
April 14, 2015, 08:25:26 pm
Hi
We are using CiviVolunteer, and trying to setup a email template in that need to display volunteer role.  I think volunteer role is in activity record type. It does not show up in the token list in email template. I can get all the custom fields I have created in the volunteer signup profile.
Looking for a way to get volunteer role as token, please help

Thanks
Naheed

GinkgoFJG

  • Moderator
  • I post frequently
  • *****
  • Posts: 135
  • Karma: 4
    • Ginkgo Street Labs
Re: How to get Volunteer Role as email token
April 20, 2015, 06:16:35 am
The Activity record type is a Volunteer activity. The volunteer role is an optionValue.

Presently, CiviVolunteer does not add any new tokens to the system, so you'll have to create the new token yourself. If you do, please make a pull request against the CiviVolunteer repository so that we can maintain your improvement and share it with the community at large.

Here's a head start. To get all the volunteer roles, you can do this:

Code: [Select]
$result = civicrm_api3('OptionGroup', 'get', array(
  'name' => "volunteer_role",
  'api.OptionValue.get' => array(),
));
Are you a CiviVolunteer user? Join the CiviVolunteer 2.0 Matching Grant effort to help the project win $15,000 in grant funding.

naheedmk

  • I’m new here
  • *
  • Posts: 5
  • Karma: 0
  • CiviCRM version: 4.5
  • CMS version: Joomla 3.3
  • MySQL version: 5.6.20
  • PHP version: 5.5.15
Re: How to get Volunteer Role as email token
April 20, 2015, 11:07:09 am
Thanks for the response.
I am not sure I need to get all the volunteer role from option group.  Need is to indicate assigned volunteer role when we send the email to volunteer contact. I believe the assigned volunteer role is inside activity record. Is it possible to access that value in template as {activity.volunteer_role}.
Also if you could provide some more details to build this feature I may get help from our non profit organization to find PHP skillset.

Thanks
Naheed

GinkgoFJG

  • Moderator
  • I post frequently
  • *****
  • Posts: 135
  • Karma: 4
    • Ginkgo Street Labs
Re: How to get Volunteer Role as email token
April 23, 2015, 05:20:19 am
The volunteer role is a custom field on the activity record. Using the CustomValue API, you should be able to retrieve the ID of the role on the activity of your choice. That ID won't be very user-friendly, though; you'll want to retrieve the human-readable label for that role, and for that the code that I've provided should be helpful.
Are you a CiviVolunteer user? Join the CiviVolunteer 2.0 Matching Grant effort to help the project win $15,000 in grant funding.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Discussion »
  • Extensions »
  • CiviVolunteer (Moderators: GinkgoFJG, Michael Z Daryabeygi) »
  • How to get Volunteer Role as email token

This forum was archived on 2017-11-26.