1

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,

Moe

2 Answers 2

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, 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, 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 is ready (also known as afform).

3
  • Note that I have my own extension 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... Nov 20, 2019 at 1:34
  • @JonG-MegaphoneTech - How does your extension work without a UI? How do i assign the fields.
    – Moe
    Nov 20, 2019 at 10:30
  • @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. Nov 20, 2019 at 18:44
2

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

Your Answer

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

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