Answers.Body: <p>what you are trying to do is to print Gift-Aid custom value in the PDF letter so you need use Token hooks - and assign an new token name for the gift-aid custom values by creating an new extension so the token will be available in the drop down list and you can print the values</p>
  
  <p>do the same for all custom values </p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-26T11:56:22.137Z
Answers.Text: I am printing PDF from  contact_summary screen. And I do not have any PDF extension..
Answers.UserDisplayName: Tapash
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-26T11:59:19.060Z
Answers.Text: Which version of Civicrm are you using - I have just created an Example in Demo (http://d46.demo.civicrm.org/civicrm/contact/view?reset=1&cid=202) try this please
Answers.UserDisplayName: Ramesh - ARTECH Consultancy
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-26T12:00:17.347Z
Answers.Text: I'm on civicdm 4.6.8
Answers.UserDisplayName: Tapash
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-26T12:01:33.540Z
Answers.Text: did you check my example against Demo - that is working fine - so please try to reinstall civicrm again - if possible
Answers.UserDisplayName: Ramesh - ARTECH Consultancy
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-26T12:02:56.180Z
Answers.Text: Yes, I have tried on demo site prior to posting and it was working fine. 
  My site is a production site, don't I have to do all over again if I reinstall civi?
Answers.UserDisplayName: Tapash
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-26T12:04:43.543Z
Answers.Text: best thing is try to disable all the extension - first and try - it might be some extension is causing this issue - please try this and let me know
Answers.UserDisplayName: Ramesh - ARTECH Consultancy
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-26T12:05:49.517Z
Answers.Text: ok, doing now..
Answers.UserDisplayName: Tapash
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-26T12:06:39.697Z
Answers.Text: Let us [continue this discussion in chat](http://chat.stackexchange.com/rooms/27424/discussion-between-ramesh-and-tapash).
Answers.UserDisplayName: Ramesh - ARTECH Consultancy
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-26T13:51:17.790Z
Answers.Text: what you are trying to do is to print Gift-Aid custom value in the PDF letter
  so what you need to do is to use Token hooks - and assign a new token name for the gift-aid custom values
  by creating a new extension
  so the token will be available in the drop down list and you can print the values
Answers.UserDisplayName: Ramesh - ARTECH Consultancy
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-26T13:51:22.797Z
Answers.Text: Example
  function civicrm_example_civicrm_tokens( &$tokens ) {
  $tokens['contact']['contact.address_block'] = 'Address block';
  }
  
  function civicrm_example_civicrm_tokenValues(&$values, $cids, $job = null, $tokens = array(), $context = null){
  
  foreach($cids as $id){
  //assign the value here by selecting it from DB
  $values[$id]['contact.address_block'] = 'test the process';
  }
  }
Answers.UserDisplayName: Ramesh - ARTECH Consultancy
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-26T14:26:53.617Z
Answers.Text: but why the existing method given by civicrm is not working? is it broken? or a bug?
Answers.UserDisplayName: Tapash
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-26T14:29:50.887Z
Answers.Text: Any custom field created for contact can be accessed directly - other than contact (say like gift aid - is created for contact type - individual ) which has to be accessed by above step
Answers.UserDisplayName: Ramesh - ARTECH Consultancy
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-26T14:31:46.400Z
Answers.Text: ok, i understand. Many Thanks for your time &  help
Answers.UserDisplayName: Tapash
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-09-03T12:16:53.467Z
Answers.Text: are you free to chat for couple min
Answers.UserDisplayName: Tapash
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-26T11:55:15.637Z
Answers.LastActivityDate: 2015-08-26T14:01:51.063Z
Answers.LastEditDate: 2015-08-26T14:01:51.063Z
Answers.UserDisplayName: Ramesh - ARTECH Consultancy
Body: <p>when I Insert a token of a custom field to print a pdf letter all built-in token seems working but not the custom ones, no value works, regardless of the number I put in the token. Do you know where the problem is please?
  <a href="https://i.sstatic.net/Xe35E.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/Xe35E.png" alt="enter image description here"></a></p>
  
  <p>this is the link where I got "50" from :<a href="http://abcd.org/civicm/...update?action=update&amp;reset=1&amp;gid=18&amp;id=50" rel="nofollow noreferrer">http://abcd.org/civicm/...update?action=update&amp;reset=1&amp;gid=18&amp;id=50</a></p>
  
Tags: <custom-fields><tokens>
Title: Token for custom field returns the token but not the Values. How to fix it?
ThreadText: # Token for custom field returns the token but not the Values. How to fix it?
  
  (Asked by: username_0 on 2015-08-26)
  
  when I Insert a token of a custom field to print a pdf letter all built-in token seems working but not the custom ones, no value works, regardless of the number I put in the token. Do you know where the problem is please?
  [![enter image description here](https://i.sstatic.net/Xe35E.png)](https://i.sstatic.net/Xe35E.png)
  
  this is the link where I got "50" from :<http://abcd.org/civicm/...update?action=update&reset=1&gid=18&id=50>
  
  **Tags:** custom-fields, tokens
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-08-26. Score: 0 | Accepted answer
  
  what you are trying to do is to print Gift-Aid custom value in the PDF letter so you need use Token hooks - and assign an new token name for the gift-aid custom values by creating an new extension so the token will be available in the drop down list and you can print the values
  
  do the same for all custom values
  
  > **Comments:**
  > **username_0**: I am printing PDF from  contact_summary screen. And I do not have any PDF extension..  
  > **username_1**: Which version of Civicrm are you using - I have just created an Example in Demo (http://d46.demo.civicrm.org/civicrm/contact/view?reset=1&cid=202) try this please  
  > **username_0**: I'm on civicdm 4.6.8  
  > **username_1**: did you check my example against Demo - that is working fine - so please try to reinstall civicrm again - if possible  
  > **username_0**: Yes, I have tried on demo site prior to posting and it was working fine.  My site is a production site, don't I have to do all over again if I reinstall civi?  
  > **username_1**: best thing is try to disable all the extension - first and try - it might be some extension is causing this issue - please try this and let me know  
  > **username_0**: ok, doing now..  
  > **username_1**: Let us [continue this discussion in chat](http://chat.stackexchange.com/rooms/27424/discussion-between-username_1-and-username_0).  
  > **username_1**: what you are trying to do is to print Gift-Aid custom value in the PDF letter so what you need to do is to use Token hooks - and assign a new token name for the gift-aid custom values by creating a new extension so the token will be available in the drop down list and you can print the values  
  > **username_1**: Example function civicrm_example_civicrm_tokens( &$tokens ) { $tokens['contact']['contact.address_block'] = 'Address block'; }  function civicrm_example_civicrm_tokenValues(&$values, $cids, $job = null, $tokens = array(), $context = null){  foreach($cids as $id){ //assign the value here by selecting it from DB $values[$id]['contact.address_block'] = 'test the process'; } }  
  > **username_0**: but why the existing method given by civicrm is not working? is it broken? or a bug?  
  > **username_1**: Any custom field created for contact can be accessed directly - other than contact (say like gift aid - is created for contact type - individual ) which has to be accessed by above step  
  > **username_0**: ok, i understand. Many Thanks for your time &  help  
  > **username_0**: are you free to chat for couple min  
  
  ---
  
  