Drupal 7, Civi 5.12 I have created custom fields for civievent bookings (to be used for Participants, Individual, Organization).

Is there an easy way for a non developer to create tokens for these custom fields so that I can include them in the Contributions Invoice template?

(I asked the same question in 2017 and found a way around by using custom contact fields, but that was kludgy).

1 Answer 1


Davy, You can use CiviCRM api to fetch the custom fields of participants, contact and then use as smarty in your message template

Something like this you can include in invoice template

{crmAPI var='result' entity='ParticipantPayment' action='get' return="participant_id.contact_id.custom_3,participant_id.custom_4" contribution_id=$id}
{assign var="contactCustomField" value="participant_id.contact_id.custom_3"}
{assign var="ParticipantCustomField" value="participant_id.custom_4"}
{foreach from=$result.values item=participantpayment}
    <td>Contact custom field</td>
    <td>Participant custom field</td>



  • Thanks for the guidance Pradeep - although I'll need to digest what you've suggested :-)
    – Davy Ivins
    Apr 10, 2019 at 16:05
  • Thank you Pradeep. Your answer worked perfectly to include my custom fields on the Invoice
    – Davy Ivins
    Apr 20, 2019 at 12:28
  • so can you mark this as answered? Apr 20, 2019 at 12:31
  • Hi Pradeep - How does one fetch an 'organization contact' custom field from the 2nd contact on a webform? My webform has Contact 1 = Individual and Contact 2 = Organisation (for employer). I've added a CiviCRM custom field (organisation type) to the webform to capture the employer's tax reference number. I can't work out how to fetch and print the tax reference number on the invoice. Thanks, Davy
    – Davy Ivins
    May 4, 2019 at 13:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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