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 »
  • Using CiviMail (Moderator: Piotr Szotkowski) »
  • tokens for custom fields - values intead of labels
Pages: [1]

Author Topic: tokens for custom fields - values intead of labels  (Read 1974 times)

adixon

  • I post frequently
  • ***
  • Posts: 314
  • Karma: 19
    • Blackfly Solutions
tokens for custom fields - values intead of labels
July 02, 2009, 02:21:12 pm
As per

http://wiki.civicrm.org/confluence/display/CRMDOC/Mail-merge+Tokens+for+Contact+Data

i've successfully added a token to my civimail footer that converts to a custom field. In this case, the field is a select, and what I really want is for the token to convert into the value rather than the label, but it's converting to the label.

Is there an alternative syntax to get this? Could there be?

If not, can you tell me where the code for this is and I'll be happy to write a little patch, for say {contact.custom_value_1}.

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: tokens for custom fields - values intead of labels
July 02, 2009, 09:06:13 pm

curious as to why you need the value? whats the use case?

no syntax for this as yet. I suspect, a good version might be: {contact.custom_1_value}. you probably can do this using token hooks and not have to hack the code: http://civicrm.org/node/480

I took a look at the code, and i suspect the hook is the cleanest place to do so :)

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: tokens for custom fields - values intead of labels
July 03, 2009, 12:38:07 am
Hi,

I had needs like that in the templates, for instance on the country, displaying  "and you can find others in your country /civicrm/profile/view?force=1&country-primary={country_id}, or employer id ... probably the same for custom fields)

(the url is probably 100% wrong, but you get the idea)

X+

-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

adixon

  • I post frequently
  • ***
  • Posts: 314
  • Karma: 19
    • Blackfly Solutions
Re: tokens for custom fields - values intead of labels
July 04, 2009, 06:05:19 am
okay, thanks, i'll check out token hooks.

my use case: i'm setting up some groups that correspond to events setup on a different system (haha, maybe next year we'll convert them to civievent), and i want civimail messages to have automated links to the corresponding pages on that system. So i set up custom values with keys of their ids, and values of the name of the group, and then generate smart groups based on those custom values.

 - Alan

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviMail (Moderator: Piotr Szotkowski) »
  • tokens for custom fields - values intead of labels

This forum was archived on 2017-11-26.