Skip to content

4.0 Open a Case Example

Go to CiviCRM Administer > System Settings > Components Enable CiviCase

alt screenshot of enable CiviCase

This is not enabled by default

For more information on CiviCase visit CiviCase Documentation

Open a Case

Create your webform as shown in Getting Started

We have given this example the Label Client

alt screenshot of CiviCase

We will collect the following information (Contact Fields) from the client First Name, Last Name and E-mail.

alt screenshot of CiviCase

On our Cases page, we will select the following options

Number of Cases is 1, Case Type Housing Support, Case Status we have chosen user select which allows the client to select from a drop-down menu, Medium is the contact method- we have chosen in person for this example. We have also selected Case Subject and Case Details. All options under the Case Roles section have remained at their default selections.

alt screenshot of CiviCase

View

Here is the View of our form

alt screenshot of CiviCase View

alt screenshot of CiviCase View

Test

Lets Test of the CiviCase form we've created:

alt screenshot of CiviCase Test

alt screenshot of CiviCase Test

alt screenshot of CiviCase Test Confirmation

Now let's check what was created in our database

alt screenshot of CiviCase Test

Build

Here is the Build of our form

alt screenshot of CiviCase Build

Form YAML

civicrm_1_contact_1_fieldset_fieldset:
  '#type': fieldset
  '#title': Client
  '#form_key': civicrm_1_contact_1_fieldset_fieldset
  civicrm_1_contact_1_contact_first_name:
    '#type': textfield
    '#contact_type': individual
    '#form_key': civicrm_1_contact_1_contact_first_name
    '#extra':
      width: 20
    '#parent': civicrm_1_contact_1_fieldset_fieldset
    '#title': 'First Name'
  civicrm_1_contact_1_contact_last_name:
    '#type': textfield
    '#contact_type': individual
    '#form_key': civicrm_1_contact_1_contact_last_name
    '#extra':
      width: 20
    '#parent': civicrm_1_contact_1_fieldset_fieldset
    '#title': 'Last Name'
  civicrm_1_contact_1_email_email:
    '#type': email
    '#form_key': civicrm_1_contact_1_email_email
    '#extra':
      width: 20
    '#parent': civicrm_1_contact_1_fieldset_fieldset
    '#title': Email
civicrm_1_case_1_fieldset_fieldset:
  '#type': fieldset
  '#title': Case
  '#form_key': civicrm_1_case_1_fieldset_fieldset
  civicrm_1_case_1_case_status_id:
    '#type': civicrm_options
    '#form_key': civicrm_1_case_1_case_status_id
    '#options':
      - '- Automatic -'
      - Ongoing
      - Resolved
      - Urgent
    '#extra':
      items: |
        0|- Automatic -
        1|Ongoing
        2|Resolved
        3|Urgent

      aslist: true
    '#parent': civicrm_1_case_1_fieldset_fieldset
    '#title': 'Case Status'
    '#default_option': null
    '#default_value': null
  civicrm_1_case_1_case_subject:
    '#type': textfield
    '#form_key': civicrm_1_case_1_case_subject
    '#extra':
      width: 20
    '#parent': civicrm_1_case_1_fieldset_fieldset
    '#title': 'Case Subject'
  civicrm_1_case_1_case_details:
    '#type': textarea
    '#form_key': civicrm_1_case_1_case_details
    '#parent': civicrm_1_case_1_fieldset_fieldset
    '#extra': {  }
    '#title': 'Case Details'