3

Webform has a browser for 'available tokens'. civicrm-contact appears in it, but none of the tokens seem to work. Is there anything I have to do to enable them ?

If I put this in the confirmation message of a testform

current-user:civicrm-contact:display-name
[current-user:civicrm-contact:display-name]
current-user:name
[current-user:name]
submission:user:civicrm-contact:display-name
[submission:user:civicrm-contact:display-name]
submission:user:name
[submission:user:name]
current-user:civicrm-contact:id
[current-user:civicrm-contact:id]

The result, when filled out by a valid civi contact, is

current-user:civicrm-contact:display-name
current-user:name
pike
submission:user:civicrm-contact:display-name
submission:user:name
pike
current-user:civicrm-contact:id
3

I suspect those tokens are coming from another module (possibly CiviCRM itself). I never added any token support to webform_civicrm. That said, the best way to achieve your goal is probably to use the token from the contact_1:existing_contact field. This has the upshot of working correctly even when the user is anonymous. It's something like

[submission:values:civicrm_1_contact_1_contact_existing]

(but would need to be adjusted if it is inside a fieldset)

  • Is there a way to get to, for example, the display name like that ? Or should I include the fields I need and I use a 'hidden' element for them (alas, display_name is not a field .. ) – commonpike Feb 3 '16 at 0:15
  • 1
    that token will render the display name of the contact – Coleman Feb 3 '16 at 3:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.