Aller directement à la fin des métadonnées
Aller au début des métadonnées

The goal of this recipe is to demonstrate how to set up a Drupal View that lists contacts of a certain case type and links to a pre-filled webform to create a new meeting.

This recipe assumes that CiviCRM, Views and Webform CiviCRM Integration are all installed and configured correctly.

For the purpose of this recipe, we will assume there is a Case Type called Intake.

Create the Webform

First we create the webform which Case Managers will use to enter new activities.

Create new webform called New Intake Meeting.

Edit the webform and click on the CiviCRM tab.

Put a check in Enable CiviCRM Processing.

Change Number of Contacts to 2.

Change Contact 1 label to Case Manager.

Under Contact Fields, select Existing Contact and nothing else (This will load the current user's name into the webform as the reporter or case manager).

On the left hand side, click on Contact 2.

Change Contact 2 label to Client.

Under Contact Fields, select Existing Contact and nothing else.  (This will load the pre-filled user name into the webform as the client or target).

On the left hand side, click on Activity/Case.

Since this form is just to update an existing case with an activity, under Update Existing Case, select Ongoing.

Under Case Client, select Client (this is Contact 1 that we changed to Client).

Under Medium, select In-Person (in this example, we will create a new meeting, but it could be for any activity associated with the case type).

Under Case Manager, select Case Manager (this is Contact 2 that we changed to Case Manager).

Under Activity Type, select Meeting.

In the Meeting Activity section, under Update Existing Activity, select None since this form will be used to create a new activity, not update an existing one.

In the Default Activity Subject field, enter Intake Meeting.

In the Activity section, include the fields you want on the webform.

Click Save Settings.

Click on the Webform tab at the top of the page.

Here you see that the first Existing Contact is the Case Manager (the current user) filling out the form.  Their name will be hidden on the webform.  My contacts aren't in a fiedlset because I unchecked that on 

The second Existing Contact is the client.  We need to make changes here.  Click on Edit in that row.

Leave Label and Field Key alone.

We want the client's name to not be editable and we want to see it.

We want to see the Display Name (John Doe) with no Label.

This part tripped me up a bit.

We are going to Set Default Contact From filters in the next section, so select Auto - From Filters.

In our case, we created an Intake Smart Group by searching for all cases Intake.  But you could set this filter to None or any other group.

Click on Save Component.

 

Create Case View

This view will list all clients assigned certain case(s) in an accordion view.

The accordion has Last Name as title (what you click to expand) and includes a link to create a new case activity to a webform preloaded with client's name.

You don't have to use an accordion view, but for our situation it works well.

Info in accordion can include:

  • Date case opened
  • Case status
  • Date case closed
  • And more…

Create new View of type CiviCRM Cases 

Create a relationship to:  CiviCRM Case Contact: Case Contact's Contact ID 


Add fields:

CiviCRM Contacts: Display Name (Display Name) (use relationship)

CiviCRM Contacts: Contact ID (use relationship)

CiviCRM Contacts: First Name (use relationship)

CiviCRM Contacts: Last Name (use relationship)

CiviCRM Cases: Case Status (Case Status)

CiviCRM Cases: Start Date (Case Opened)

CiviCRM Cases: End Date (Case Closed)

Global: Custom text

Important!

When adding fields that may be passed in a url (Contact ID, Case ID or Activity ID), make sure that for that field, change the Thousands Marker selection to none.  By default, comma is selected and will screw up your urls.

The last field, Custom text is where you rewrite the url to the url of your webform followed by ?cid2=[id_1].

In our case:

node/9?cid2=[id_1]

(node/9 is the webform we want to populate with the client's name, cid2 is the second contact on the webform, and [id_1] is the token for the clients unique id)

Hit Apply and preview your view below.

Right click on the link you created and open in a new tab.  The form should open with the contact's display name already filled into the form.

Nice work you smooth operator.

 

Étiquette
  • Aucun
  1. Nov 25, 2014

    Peter Davis dit :

    Great notes. And for anyone that has a need to be able to update an existing activity - you can pull the CiviCRM Activities: Activity ID in to the View as well, and tag on to the url eg node/9?cid2=[id_1]&aid=[id]