> ## Documentation Index
> Fetch the complete documentation index at: https://docs.morf.health/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Or Update Questionnaire

> Documentation for the Create Or Update Questionnaire action for Intakeq

![images/intakeq.svg](https://mintcdn.com/morfhealth/EU2WCxuXGIUQcziR/images/intakeq.svg?fit=max\&auto=format\&n=EU2WCxuXGIUQcziR\&q=85\&s=191a6c088f13edff5cd7f23a84babb49)

## Delivery Logic

Morf uses the following logic to determine whether the questionnaire is sent via email or phone:

* If no **Client ID** is specified, the client ID on the Morf profile is used and the questionnaire is sent to the email on the IntakeQ client.
* If **Client Full Name** is specified, either email or phone must also be specified.
  * If both email and phone are specified, the questionnaire is sent via **email**.

> [!TIP]
>
> Use the answers map to automatically populate office-use only questions.

# Parameters

**Action** `Parameters`

**parameters**

**Client ID** `int64`

`ID`
This field maps to the destination API `ClientId` field.

**Client Full Name** `string`

`PII`
This field maps to the destination API `ClientName` field.

**Client Email Address** `string`

`PII`
This field maps to the destination API `ClientEmail` field.

**Client Phone Number** `string`

`PII`
This field maps to the destination API `ClientPhone` field.

**Questionnaire ID** `string (Questionnaire)` *required*

`HI`
This field maps to the destination API `QuestionnaireId` field.

**Practitioner ID** `string (Practitioner)`

`HI`
This field maps to the destination API `PractitionerId` field.

**Existing Questionnaire Intake Form ID** `string`

`ID`
This field maps to the destination API `Id` field.

**Answers** `Map\<Question,string\>`

`HI` `ID` `PII`
This field maps to the destination API `questions` field.

```json Result Object Example theme={null}
{
  "$result_object_key": {
    "appointment_id": "12342",
    "client_email": "john.smith@example.com",
    "client_id": 42,
    "client_name": "John Smith",
    "consent_forms": [
      {
        "document_type": "HIPAA",
        "id": "12342",
        "name": "HIPAA Consent",
        "signed": true,
        "submitted_at": "2024-01-23T10:30:00Z"
      }
    ],
    "created_at": "2024-01-23T10:00:00Z",
    "external_client_id": "a7699305-7142-4599-a661-717b6bcd3305",
    "id": "12342",
    "practitioner": "acbdefg",
    "practitioner_name": "Dr. Marie Curie",
    "questionnaire_name": "Initial Intake Form",
    "questions": [
      {
        "answer": "Back pain",
        "attachments": [
          {
            "content_type": "application/pdf",
            "file_name": "medical_report.pdf",
            "id": "12342",
            "url": "https://example.com/attachment.pdf"
          }
        ],
        "client_profile_field_id": "primary_concern",
        "column_names": [
          "Symptom",
          "Severity"
        ],
        "id": "12342",
        "office_note": "Patient reported severe pain",
        "office_use": false,
        "question_type": "text",
        "rows": [
          {
            "answers": [
              "Back pain",
              "Severe"
            ],
            "text": "Back pain"
          }
        ],
        "text": "What is your primary concern?"
      }
    ],
    "status": "Submitted",
    "submitted_at": "2024-01-23T10:30:00Z"
  }
}
```

```json Result Object Description theme={null}
{
  "$result_object_key": {
    "appointment_id": "ID of the associated appointment",
    "client_email": "Email address of the client",
    "client_id": "IntakeQ's unique identifier for the client",
    "client_name": "Full name of the client",
    "consent_forms": {
      "document_type": "Type of the consent document",
      "id": "Unique identifier for the consent form",
      "name": "Name of the consent form",
      "signed": "Whether the consent form has been signed",
      "submitted_at": "Time the consent form was submitted"
    },
    "created_at": "Time the intake form was created",
    "external_client_id": "External system client ID",
    "id": "Unique identifier for the intake form",
    "practitioner": "ID of the practitioner",
    "practitioner_name": "Name of the practitioner",
    "questionnaire_name": "Name of the questionnaire",
    "questions": {
      "answer": "Answer to the question",
      "attachments": {
        "content_type": "Content type of the attachment",
        "file_name": "Name of the attached file",
        "id": "Unique identifier for the attachment",
        "url": "URL of the attachment"
      },
      "client_profile_field_id": "ID of the client profile field this question maps to",
      "column_names": "Column names for table/grid questions",
      "id": "Unique identifier for the question",
      "office_note": "Office note for the question",
      "office_use": "Whether the question is for office use only",
      "question_type": "Type of the question",
      "rows": {
        "answers": "Answers for each column in the row",
        "text": "Text for the row"
      },
      "text": "Text of the question"
    },
    "status": "Status of the intake form",
    "submitted_at": "Time the intake form was submitted"
  }
}
```

### Result Object Field Details

You can use the result of the action's data as inputs to downstream workflow actions.

Each fetch action requires an object name, which nests the action's result data inside the downstream data context in the workflow. See [Passing Data Between Actions](https://docs.morf.health/docs/knowledge_base/passing_data_between_actions.md) for how to set it and reference the result from downstream nodes.

Here we demonstrate how to refer to this data using the prefix `$result_object_key`.

**IntakeForm** `Fetch Action Response Object`

**fields**

**id** `string` *required*

Unique identifier for the intake form

```json CEL theme={null}
$result_object_key.id
```

```json Example theme={null}
"12342"
```

**client\_name** `string`

`PII` Full name of the client

```json CEL theme={null}
$result_object_key.client_name
```

```json Example theme={null}
"John Smith"
```

**client\_email** `string`

`PII` Email address of the client

```json CEL theme={null}
$result_object_key.client_email
```

```json Example theme={null}
"john.smith@example.com"
```

**client\_id** `int64` *required*

`ID` IntakeQ's unique identifier for the client

```json CEL theme={null}
$result_object_key.client_id
```

```json Example theme={null}
42
```

**status** `string` *required*

Status of the intake form

```json CEL theme={null}
$result_object_key.status
```

```json Example theme={null}
"Submitted"
```

**created\_at** `timing.v1.Timestamp` *required*

Time the intake form was created

```json CEL theme={null}
$result_object_key.created_at
```

```json Example theme={null}
"2024-01-23T10:00:00Z"
```

**submitted\_at** `timing.v1.Timestamp` *required*

Time the intake form was submitted

```json CEL theme={null}
$result_object_key.submitted_at
```

```json Example theme={null}
"2024-01-23T10:30:00Z"
```

**questionnaire\_name** `string` *required*

Name of the questionnaire

```json CEL theme={null}
$result_object_key.questionnaire_name
```

```json Example theme={null}
"Initial Intake Form"
```

**practitioner** `string`

ID of the practitioner

```json CEL theme={null}
$result_object_key.practitioner
```

```json Example theme={null}
"acbdefg"
```

**practitioner\_name** `string`

Name of the practitioner

```json CEL theme={null}
$result_object_key.practitioner_name
```

```json Example theme={null}
"Dr. Marie Curie"
```

**questions** `[]object` *required*

`HI` Questions and answers in the intake form

```json CEL theme={null}
$result_object_key.questions
```

```json Example theme={null}
[
{
"answer": "Back pain",
"attachments": [
{
  "content_type": "application/pdf",
  "file_name": "medical_report.pdf",
  "id": "12342",
  "url": "https://example.com/attachment.pdf"
}
],
"client_profile_field_id": "primary_concern",
"column_names": [
"Symptom",
"Severity"
],
"id": "12342",
"office_note": "Patient reported severe pain",
"office_use": false,
"question_type": "text",
"rows": [
{
  "answers": [
    "Back pain",
    "Severe"
  ],
  "text": "Back pain"
}
],
"text": "What is your primary concern?"
}
]
```

**questions.map(x, x.id)** `[]string` *required*

Mapped array of: Unique identifier for the question

```json CEL theme={null}
$result_object_key.questions.map(x, x.id)
```

```json Example theme={null}
[
"12342"
]
```

**questions.map(x, x.text)** `[]string` *required*

Mapped array of: Text of the question

```json CEL theme={null}
$result_object_key.questions.map(x, x.text)
```

```json Example theme={null}
[
"What is your primary concern?"
]
```

**questions.map(x, x.answer)** `[]string` *required*

`HI` Mapped array of: Answer to the question

```json CEL theme={null}
$result_object_key.questions.map(x, x.answer)
```

```json Example theme={null}
[
"Back pain"
]
```

**questions.map(x, x.question\_type)** `[]string` *required*

Mapped array of: Type of the question

```json CEL theme={null}
$result_object_key.questions.map(x, x.question_type)
```

```json Example theme={null}
[
"text"
]
```

**questions.map(x, x.rows)** `[]bool` *required*

`HI` Mapped array of: Rows for table/grid questions

```json CEL theme={null}
$result_object_key.questions.map(x, x.rows)
```

```json Example theme={null}
[
[
{
"answers": [
  "Back pain",
  "Severe"
],
"text": "Back pain"
}
]
]
```

**questions.map(x, x.column\_names)** `[]bool` *required*

Mapped array of: Column names for table/grid questions

```json CEL theme={null}
$result_object_key.questions.map(x, x.column_names)
```

```json Example theme={null}
[
[
"Symptom",
"Severity"
]
]
```

**questions.map(x, x.office\_use)** `[]bool` *required*

Mapped array of: Whether the question is for office use only

```json CEL theme={null}
$result_object_key.questions.map(x, x.office_use)
```

```json Example theme={null}
[
false
]
```

**questions.map(x, x.office\_note)** `[]string` *required*

Mapped array of: Office note for the question

```json CEL theme={null}
$result_object_key.questions.map(x, x.office_note)
```

```json Example theme={null}
[
"Patient reported severe pain"
]
```

**questions.map(x, x.client\_profile\_field\_id)** `[]string` *required*

Mapped array of: ID of the client profile field this question maps to

```json CEL theme={null}
$result_object_key.questions.map(x, x.client_profile_field_id)
```

```json Example theme={null}
[
"primary_concern"
]
```

**questions.map(x, x.attachments)** `[]bool` *required*

`HI` Mapped array of: Attachments associated with the question

```json CEL theme={null}
$result_object_key.questions.map(x, x.attachments)
```

```json Example theme={null}
[
[
{
"content_type": "application/pdf",
"file_name": "medical_report.pdf",
"id": "12342",
"url": "https://example.com/attachment.pdf"
}
]
]
```

**appointment\_id** `string`

ID of the associated appointment

```json CEL theme={null}
$result_object_key.appointment_id
```

```json Example theme={null}
"12342"
```

**external\_client\_id** `string`

`ID` External system client ID

```json CEL theme={null}
$result_object_key.external_client_id
```

```json Example theme={null}
"a7699305-7142-4599-a661-717b6bcd3305"
```

**consent\_forms** `[]object` *required*

`HI` Consent forms associated with the intake form

```json CEL theme={null}
$result_object_key.consent_forms
```

```json Example theme={null}
[
{
"document_type": "HIPAA",
"id": "12342",
"name": "HIPAA Consent",
"signed": true,
"submitted_at": "2024-01-23T10:30:00Z"
}
]
```

**consent\_forms.map(x, x.id)** `[]string` *required*

Mapped array of: Unique identifier for the consent form

```json CEL theme={null}
$result_object_key.consent_forms.map(x, x.id)
```

```json Example theme={null}
[
"12342"
]
```

**consent\_forms.map(x, x.name)** `[]string` *required*

Mapped array of: Name of the consent form

```json CEL theme={null}
$result_object_key.consent_forms.map(x, x.name)
```

```json Example theme={null}
[
"HIPAA Consent"
]
```

**consent\_forms.map(x, x.document\_type)** `[]string` *required*

Mapped array of: Type of the consent document

```json CEL theme={null}
$result_object_key.consent_forms.map(x, x.document_type)
```

```json Example theme={null}
[
"HIPAA"
]
```

**consent\_forms.map(x, x.signed)** `[]bool` *required*

Mapped array of: Whether the consent form has been signed

```json CEL theme={null}
$result_object_key.consent_forms.map(x, x.signed)
```

```json Example theme={null}
[
true
]
```

**consent\_forms.map(x, x.submitted\_at)** `[]timing.v1.Timestamp` *required*

Mapped array of: Time the consent form was submitted

```json CEL theme={null}
$result_object_key.consent_forms.map(x, x.submitted_at)
```

```json Example theme={null}
[
"2024-01-23T10:30:00Z"
]
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.