Skip to main content

LegalServer Data Reference

The legalserver_data variable is a raw Python dictionary containing all case details fetched from the LegalServer API.

Important: Because this is a standard dictionary, you must use bracket notation (e.g., legalserver_data['case_number']) to access its keys. The standard "dot notation" (e.g., legalserver_data.case_number) will not work.

Common Object Structures

Many fields in legalserver_data return nested dictionaries. Use the following keys to access their attributes:

1. Lookup Values

Fields representing a selection from a LegalServer lookup table (dropdown) return a dictionary with these keys:

KeyDescription
['lookup_value_name']The human-readable label (e.g., "Active").
['lookup_value_id']The internal LegalServer ID.
['lookup_value_uuid']The unique UUID.
['lookup_type_name']The name of the lookup table.

Example: {{ legalserver_data['case_status']['lookup_value_name'] }}

2. User/Staff Objects

Fields representing a staff member or user return a dictionary with these keys:

KeyDescription
['user_name']The full name of the user.
['user_id']The internal LegalServer ID.
['user_uuid']The unique UUID.

Example: {{ legalserver_data['intake_user']['user_name'] }}


Usage Examples (Jinja2)

Use these snippets as a guide for accessing deep attributes and looping through lists in your templates.

Looping through Assignments

Display a list of all staff members and their assignment types:

{%p for assignment in legalserver_data['assignments'] %}
- {{ assignment['user']['user_name'] }} ({{ assignment['type']['lookup_value_name'] }})
{%p endfor %}

Formatted Income Table (Word/DOCX)

When automating a table in a Word template, use the tr (table row) control tags. Place the for and endfor tags in their own standalone rows:

TypeAmountPeriod
{%tr for income in legalserver_data['incomes'] %}
{{ income['type']['lookup_value_name'] }}{{ income['amount'] }}{{ income['period'] }}
{%tr endfor %}
tip

In Word templates, the {%tr %} tag ensures that the entire row is repeated or removed based on the data, maintaining the table's structure.

Accessing Nested Client Data

Access specific parts of a nested object, like the home city:

{{ legalserver_data['client_address_home']['city'] }}

Key Case Objects

Core Case Details

FieldTypeDescription
case_idIntegerInternal ID.
case_numberStringThe primary case number (e.g., "21-0207916").
case_statusLookupThe current status (e.g., "Active").
case_dispositionLookupThe case disposition.
date_openedStringISO date of intake.
matter_uuidStringUnique UUID for the case.

Client Information

FieldTypeDescription
client_full_nameStringThe client's full name.
first, middle, lastStringIndividual name components.
client_email_addressStringPrimary email.
mobile_phoneStringMobile number.
client_address_homeObjectNested address object (street, city, state, zip).
client_genderLookupClient gender.
citizenshipLookupCitizenship status.

Financial & Eligibility

FieldTypeDescription
income_eligibleBooleanWhether the client is income eligible.
asset_eligibleBooleanWhether the client is asset eligible.
percentage_of_povertyStringPoverty percentage (e.g., "0%").
total_liquid_assetsStringFormatted currency string.
incomesListList of income records. See the Related Lists section.
FieldTypeDescription
legal_problem_codeLookupThe primary problem code (e.g., "99 Other").
legal_problem_categoryLookupThe group category for the problem code.

These fields contain lists of related records. Use for loops to iterate through them.

assignments

A list of staff members assigned to the case.

  • ['user']: User dictionary.
  • ['type']: Lookup dictionary (e.g., "Primary", "Co-counsel").
  • ['start_date'], ['end_date']: Assignment dates.

notes

The case notes/history.

  • ['subject']: The note title.
  • ['body']: The content (may contain HTML).
  • ['created_by']: User dictionary.
  • ['date_posted']: ISO date.
  • ['note_type']: Lookup dictionary.
  • ['is_html']: Boolean.

incomes

List of income records.

  • ['amount']: Formatted string (e.g., "$0.01").
  • ['period']: String (e.g., "Weekly").
  • ['type']: Lookup dictionary.
  • ['exclude']: Boolean.

documents

Files attached to the LegalServer record.

  • ['name']: The file name.
  • ['title']: The document title.
  • ['download_url']: Path to download the file.

contacts

Litigation or case contacts.

  • ['first'], ['last']: Contact name.
  • ['phone_business']: Work number.
  • ['case_contact_type']: Lookup dictionary.

associated_cases

Other cases linked to this client or matter.

  • ['matter_identification_number']: The case number.
  • ['matter']: The case title.
  • ['matter_uuid']: Unique ID.