We have a situation where staff will be filling in a Drupal webform in order to record an activity on a contact within Civi.

We are looking for a way to pull out some data from Civi into the webform by way of typing the contact into the 'Existing Contact' field. We know how to pull out the standard info about an existing contact (eg. Display Name, Address, Postcode etc.) Which gets displayed in this box on the webform. front view of drupal webform

But we want to be able to pull out a 'custom field' that we added to the contact in Civi which describes how much VAT that contact is paying. In Civi the field is either populated with '20%' or '0%' and we need it displayed on the form so that the staff member filling in the activity knows how much VAT that contact pays without having to go into the Civi contact to see the amount and then back out to finish the form.

So we are thinking we just need to find a way to get the custom fields to show in the following list so that we can select it for view. Is this right? It doesn't need to be editable in anyway, just a view. edit component view of existing contact field


We did nothing special, the custom fields showed up for contact in the webform settings? Like so (on the CiviCRM tab in the Webform): enter image description here

And if you then click 'Yes' you can use the custom fields?

| improve this answer | |
  • Great! That's exactly what I was looking for, thanks! – GN12AD45 Sep 8 '15 at 12:09

You can make a field view only by editing the field checking the Disabled box near the bottom of the list of options. (IMHO, not a very good name for the box)

enter image description here

| improve this answer | |
  • This is what we plan to do as we don't want the field to be editable, just 'view only' but it's getting the field to appear in the drupal form in the first place as the field in which the VAT is recorded per individual is a custom field in Civi. The field is also changeable according to the record in Civi so it can't just be a case of adding a pre-filled disabled field in drupal webform as it needs to change with the Civi record. – GN12AD45 Sep 8 '15 at 8:45

Are you using the Drupal module Webform CiviCRM Integration? It will allow you to show the custom data as far as I know?

| improve this answer | |
  • Yes we do have that module. It allows you to create custom fields in Civi which you can put into the Drupal webform which, when filled in the webform, updates the custom fields in Civi. But we do not want to update a custom field. We just want to be able to view the Civi data already in a custom field via the drupal webform. Currently I cannot find a way to view Civi custom field data in Drupal webforms. – GN12AD45 Sep 2 '15 at 14:39
  • If you know how to show the custom data, could you please explain how you do this? – GN12AD45 Sep 2 '15 at 14:39
  • If it is just displaying the data, could you not use Views to display CiviCRM data? Or do you also need to input data so you need Webform? If you want to use custom tables in Views you will have to add the tables to the Drupal settings.php (like to core CiviCRM tables). Alternative is to add some Drupal customization to show the data on the Webform. – ErikH - CiviCooP Sep 3 '15 at 6:49
  • Unfortunately we need the form. The staff member will type the name of the individual into an 'existing contact field' on the drupal webform which will display the information from Civi, then they will fill in the activity via the drupal webform which, when submitted, will attach as an activity to the Civi contact record which they selected in the 'existing contact field'. The field we need to be viewable in the drupal form is a 'custom field' in Civi which will tell the staff member what VAT is associated with that contact and will therefore determine what they put in the activity. – GN12AD45 Sep 8 '15 at 8:52
  • I thought perhaps it would be some customization but wanted to check in case there was an easy way that I wasn't aware of. – GN12AD45 Sep 8 '15 at 8:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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