I created a custom field set and a custom field used for memberships. Now i would like to insert the data from the custom field into my e-mail template. So i tried to find the custom field id by going to the edit custom field page:


So i presume that the the id is membership.custom_4 (???) However when i add another Custom Field in the same group, I also find the same id. So it looks like the id that i find is from the Custom Field Set.

My question/problem is: what is the correct way to find out the custom field id and what is the correct syntax for this membership custom field within Smarty

When using the following code in the e-mail, the mail is not sent and the interface hangs forever. I only use plain text e-mail for testing.

{capture assign=lic}{membership.custom_4}{/capture}

1 Answer 1


It depends on which message template you are trying to add token to and method you are using for sending email.

Not all method of sending email renders membership token. If you are successful to render {membership.id} or if you can get membership from smarty then you can use CiviCRM api to render the custom field value for membership based on membership id.

For ref: How to create tokens for custom fields (participant, individual, organisation)



  • Thank you Pradeep,
    – Benn54
    Commented Dec 19, 2019 at 15:35
  • Thank you Pradeep, I am using existing tokens that are created by the Fuzion Tokens exttension. These are redered okay. But the tokens for the created custom fields are not in this extension. I am sending email via smtp. When i put a {debug} in the message template i get an email with a lot of data but no custom id or anything like that. The example with the api is far too complex for me. Sorry.
    – Benn54
    Commented Dec 19, 2019 at 15:47

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.