Answers.Body: <p>I wasn't able to figure this out so data is Fetched directly into CiviCRM. However, I ended up using Drupal EntityQuery and fetched the data into a webform then Used Javascript PopUp Feature and parsed the data back into the CiviCRM form using Jquery.</p>
  
  <p>Thanks</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-12-10T15:27:34.917Z
Answers.LastActivityDate: 2019-12-10T15:27:34.917Z
Answers.UserDisplayName: Moe
Answers.Body: <p>On which forms do you wish to add the fields/logic?</p>
  
  <p>I feel like there are two questions here:</p>
  
  <p>1) How to build an arbitrary list of options from a third-party source of data (Drupal)</p>
  
  <p>2) How to set the value of one field based on the value of another fields.</p>
  
  <p>For (1), arbitrary lists, you can look into <a href="https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_fieldOptions/" rel="nofollow noreferrer">hook_civicrm_fieldOptions</a>, which can dynamically modify the option list for any field. I believe the value still needs to be valid, but if it's a select that stores an integer or a string, I think it's OK.</p>
  
  <p>For (2), I have an extension called <a href="https://lab.civicrm.org/extensions/fieldconditions/tree/master" rel="nofollow noreferrer">fieldconditions</a>, but it is not end-user oriented because it requires writing custom javascript (I would be happy to improve it, if anyone is interested).</p>
  
  <p>Alternatively, CMS-specific form builders (Caldera for WordPress, Webform for Drupal7) might be able to help, until <a href="https://civicrm.org/blog/colemanw/building-form-builder" rel="nofollow noreferrer">formbuilder</a> is ready (also known as <a href="https://lab.civicrm.org/extensions/afform" rel="nofollow noreferrer">afform</a>).</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-11-20T01:34:08.727Z
Answers.Text: Note that I have my own extension [fieldlookup](https://github.com/MegaphoneJon/fieldlookup) that does the same thing as fieldconditions.  It doesn't require writing generic JavaScript, but doesn't have a UI yet.  At some point we'll have to join these two extensions together...
Answers.UserDisplayName: Jon G - Megaphone Tech
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-11-20T10:30:39.650Z
Answers.Text: @JonG-MegaphoneTech - How does your extension work without a UI? How do i assign the fields.
Answers.UserDisplayName: Moe
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-11-20T18:44:25.617Z
Answers.Text: @Moe - you know what, I haven't yet added the callback function feature yet, so mine may not be ready for you.  Using `hook-civicrm_fieldOptions` is a good choice though.  I actually thought I had an example for you, but it uses a deprecated earlier version of that hook.
Answers.UserDisplayName: Jon G - Megaphone Tech
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-11-19T13:46:04.587Z
Answers.LastActivityDate: 2019-11-19T13:46:04.587Z
Answers.UserDisplayName: bgm
Body: <p>I am interested to know if it is possible to fetch node data from Drupal into CiviCRM.</p>
  
  <p>Is there anyway to do this?</p>
  
  <p>My End Goal is to to populate a "select list" with node titles from drupal and depending on which title you choose, fields values will change.</p>
  
  <p>Thanks,</p>
  
  <p>Moe</p>
  
Tags: <drupal><custom-fields><ajax><jquery>
Title: Fetch Node data from drupal into CiviCRM
ThreadText: # Fetch Node data from drupal into CiviCRM
  
  (Asked by: username_0 on 2019-11-19)
  
  I am interested to know if it is possible to fetch node data from Drupal into CiviCRM.
  
  Is there anyway to do this?
  
  My End Goal is to to populate a "select list" with node titles from drupal and depending on which title you choose, fields values will change.
  
  Thanks,
  
  username_0
  
  **Tags:** drupal, custom-fields, ajax, jquery
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_0 on 2019-12-10. Score: 2 | Accepted answer
  
  I wasn't able to figure this out so data is Fetched directly into CiviCRM. However, I ended up using Drupal EntityQuery and fetched the data into a webform then Used Javascript PopUp Feature and parsed the data back into the CiviCRM form using Jquery.
  
  Thanks
  
  
  ---
  
  ### Answer by username_1 on 2019-11-19. Score: 2
  
  On which forms do you wish to add the fields/logic?
  
  I feel like there are two questions here:
  
  1) How to build an arbitrary list of options from a third-party source of data (Drupal)
  
  2) How to set the value of one field based on the value of another fields.
  
  For (1), arbitrary lists, you can look into [hook\_civicrm\_fieldOptions](https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_fieldOptions/), which can dynamically modify the option list for any field. I believe the value still needs to be valid, but if it's a select that stores an integer or a string, I think it's OK.
  
  For (2), I have an extension called [fieldconditions](https://lab.civicrm.org/extensions/fieldconditions/tree/master), but it is not end-user oriented because it requires writing custom javascript (I would be happy to improve it, if anyone is interested).
  
  Alternatively, CMS-specific form builders (Caldera for WordPress, Webform for Drupal7) might be able to help, until [formbuilder](https://civicrm.org/blog/colemanw/building-form-builder) is ready (also known as [afform](https://lab.civicrm.org/extensions/afform)).
  
  > **Comments:**
  > **username_2**: Note that I have my own extension [fieldlookup](https://github.com/MegaphoneJon/fieldlookup) that does the same thing as fieldconditions.  It doesn't require writing generic JavaScript, but doesn't have a UI yet.  At some point we'll have to join these two extensions together...  
  > **username_0**: @JonG-MegaphoneTech - How does your extension work without a UI? How do i assign the fields.  
  > **username_2**: @username_0 - you know what, I haven't yet added the callback function feature yet, so mine may not be ready for you.  Using `hook-civicrm_fieldOptions` is a good choice though.  I actually thought I had an example for you, but it uses a deprecated earlier version of that hook.  
  
  ---
  
  