---
schema_version: "1"
id: 19deea2bf3cbee6d5c0a6bf34e7c03c3923720695cdde8b4391c3f9d310e8184
title: MedicationDispense
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/life_sciences_dev_guide/hc_r4_api_objects_medicationdispense.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.life_sciences_dev_guide.meta/life_sciences_dev_guide/hc_r4_api_objects_medicationdispense.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 46d6fe5b5002559b1f5d576afc4f7eab21c77b0e2a38783fbeebfe4e9fcb876c
description: Represents the dispense of a medication to a patient in response to a medication request or order. This object also includes the instructions for how the medication is to be administered This object is available in API version 54.0 and later.
---
# MedicationDispense

Represents the dispense of a medication to a patient in response to a medication request or order. This object also includes the instructions for how the medication is to be administered This object is available in API version 54.0 and later.

![Important](https://developer.salesforce.com/docs/atlas.en-us.life_sciences_dev_guide.meta/life_sciences_dev_guide/images/icon_note_important.png)

#### Important

Where possible, we changed noninclusive terms to align with our company value of Equality. We maintained certain terms to avoid any effect on customer implementations.

## Supported Calls

create(), delete(), describeLayout(), describeSObjects(), getDeleted(), getUpdated(), query(), retrieve(), search(), undelete(), update(), upsert()

## Additional Information for MedicationStatement in Other Objects

In addition to creating a record using these fields, you can add more details to your MedicationDispense record by creating records in certain other objects, and referencing your MedicationDispense record as the parent record. Here’s the list of objects you can associate to MedicationStatement in this way, the type of information they add, and the field they use to reference MedicationStatement.

| Object | Type of Information | Reference Field |
| --- | --- | --- |
| Identifier | Associates an identifier value to the medication dispense. | ParentRecordId |

## Fields

### CollectedBy

- **Type**: reference
- **Properties**: Create, Filter, Group, Nillable, Sort, Update
- **Description**: The contact, account, or a healthcare provider who collected the dispensed medication. This field is available in API version 55.0 and later.
    
    This field is a polymorphic relationship field.
- **Relationship Name**: CollectedBy
- **Relationship Type**: Lookup
- **Refers To**: Account, Contact, HealthcareProvider

### ContextId

- **Type**: reference
- **Properties**: Create, Filter, Group, Nillable, Sort, Update
- **Description**: The encounter that establishes the context for the dispense of a medication.
- **Refers To**:
    - ClinicalEncounter

### DeliveryLocationId

- **Type**: reference
- **Properties**: Create, Filter, Group, Nillable, Sort, Update
- **Description**: The location where the dispensed medication will be delivered. This field is available in API version 55.0 and later.
    
    This field is a polymorphic relationship field.
- **Relationship Name**: DeliveryLocation
- **Relationship Type**: Lookup
- **Refers To**: HealthcareFacility, Location

### DispenseTypeCodeId

- **Type**: Polymorphic lookup
- **Properties**: Create, Filter, Group, Nillable, Sort, Update
- **Description**: The system-defined code that identifies the dispense event type. For instance, a first fill, trial fill, or refill.
- **Refers To**:
    - CodeSet
    - CodeSetBundle

### DispensedDateTime

- **Type**: dateTime
- **Properties**: Create, Filter, Nillable, Sort, Update
- **Description**: The date and time when the medication was handed over.

### HealthcareFacilityId

- **Type**: reference
- **Properties**: Create, Filter, Group, Nillable, Sort, Update
- **Description**: The location where the dispense occurred.
- **Refers To**:
    - HealthcareFacility

### IsSubstituted

- **Type**: boolean
- **Properties**: Create, Defaulted on create, Filter, Group, Sort, Update
- **Description**: Indicates whether a substitute medication was dispensed.
    
    This field is available in API version 55.0 and later.
- **Default value**: false

### LastReferencedDate

- **Type**: dateTime
- **Properties**: Filter, Nillable, Sort
- **Description**: The date and time when the record was last referenced.

### LastViewedDate

- **Type**: dateTime
- **Properties**: Filter, Nillable, Sort
- **Description**: The date and time when the record was last viewed.

### MedAdministrationSettingCategory

- **Type**: picklist
- **Properties**: Create, Filter, Group, Nillable, Sort, Update
- **Description**: Specifies the setting in which the medication is expected to be administered to the patient.
- **Possible values**:
    - Inpatient
    - Outpatient
    - Community
    - Discharge

### MedicationCodeId

- **Type**: reference
- **Properties**: Create, Filter, Group, Nillable, Sort, Update
- **Description**: The system-defined code that identifies the medication that's dispensed.
- **Refers To**:
    - CodeSet
    - CodeSetBundle

### MedicationId

- **Type**: reference
- **Properties**: Create, Filter, Group, Nillable, Sort, Update
- **Description**: The medication that's dispensed.
- **Relationship Name**: Medication
- **Relationship Type**: Lookup
- **Refers To**:
    - Medication

### Name

- **Type**: string
- **Properties**: Autonumber, Defaulted on create, Filter, idLookup, Sort
- **Description**: The name of the record.

### PatientId

- **Type**: Master-detail reference
- **Properties**: Create, Filter, Group, Sort
- **Description**: The patient for whom the medication is dispensed.
- **Refers To**:
    - Account

### PreparedDateTime

- **Type**: dateTime
- **Properties**: Create, Filter, Nillable, Sort, Update
- **Description**: The date and time when the medication was prepared for dispense.

### PrimaryDetectedIssueId

- **Type**: reference
- **Properties**: Create, Filter, Group, Nillable, Sort, Update
- **Description**: The primary clinical issue associated with the medication dispensation. This field is available in API version 55.0 and later.
    
    This field is a relationship field.
- **Relationship Name**: PrimaryDetectedIssue
- **Relationship Type**: Lookup
- **Refers To**: ClinicalDetectedIssue

### PrimaryMedicationRequestId

- **Type**: reference
- **Properties**: Create, Filter, Group, Nillable, Sort, Update
- **Description**: The primary medication request that authorized the dispense of the medication.
- **Refers To**:
    - MedicationRequest

### PrimaryProcedureId

- **Type**: reference
- **Properties**: Create, Filter, Group, Nillable, Sort, Update
- **Description**: The primary medical procedure associated with the medication dispensation. This field is available in API version 55.0 and later.
    
    This field is a relationship field.
- **Relationship Name**: PrimaryProcedure
- **Relationship Type**: Lookup
- **Refers To**: PatientMedicalProcedure

### Quantity

- **Type**: double
- **Properties**: Create, Filter, Nillable, Sort, Update
- **Description**: The quantity of medication that was dispensed.

### QuantityUnitId

- **Type**: reference
- **Properties**: Create, Filter, Group, Nillable, Sort, Update
- **Description**: The unit of the quantity of medication that was dispensed.
- **Refers To**:
    - UnitOfMeasure

### SourceSystem

- **Type**: string
- **Properties**: Create, Filter, Group, Nillable, Sort, Update
- **Description**: The name of the system this record came from.

### SourceSystemIdentifier

- **Type**: string
- **Properties**: Create, Filter, Group, Nillable, Sort, Update
- **Description**: The ID of this record in its source system.

### SourceSystemModifiedDateTime

- **Type**: dateTime
- **Properties**: Create, Filter, Nillable, Sort, Update
- **Description**: The date and time when this item was last changed in the source system.

### Status

- **Type**: picklist
- **Properties**: Create, Filter, Group, Nillable, Sort, Update
- **Description**: Specifies the status of the dispense event.
- **Possible values**:
    - Cancelled
    - Completed
    - Declined
    - Entered-In-Error
    - In-Progress
    - On-Hold
    - Preparation
    - Stopped
    - Unknown

### StatusReasonCodeId

- **Type**: Polymorphic reference
- **Properties**: Create, Filter, Group, Nillable, Sort, Update
- **Description**: The system-defined code that specifies the reason for the specified status.
- **Refers To**:
    - CodeSet
    - CodeSetBundle

### StatusReasonRelatedIssueId

- **Type**: reference
- **Properties**: Create, Filter, Group, Nillable, Sort, Update
- **Description**: Specifies clinical issue that resulted in the status of the medication dispensation. This field is available in API version 55.0 and later.
    
    This field is a relationship field.
- **Relationship Name**: StatusReasonRelatedIssue
- **Relationship Type**: Lookup
- **Refers To**: ClinicalDetectedIssue

### SubstitutedById

- **Type**: reference
- **Properties**: Create, Filter, Group, Nillable, Sort, Update
- **Description**: Specifies the user or healthcare provider who substituted the medication. This field is available in API version 55.0 and later.
    
    This field is a polymorphic relationship field.
- **Relationship Name**: SubstitutedBy
- **Relationship Type**: Lookup
- **Refers To**: HealthcareProvider, User

### SubstitutionReason

- **Type**: multipicklist
- **Properties**: Create, Filter, Nillable, Update
- **Description**: Specifies the reason for substituting the medication.
    
    This field is available in API version 55.0 and later.
- **Possible values**:
    - Continuing therapy
    - Formulary policy
    - Out of stock
    - Regulatory requirement

### SubstitutionType

- **Type**: picklist
- **Properties**: Create, Filter, Group, Nillable, Sort, Update
- **Description**: Specifies the type of substitution done for the medication.
    
    This field is available in API version 55.0 and later.
- **Possible values**:
    - Brand composition
    - Equivalent
    - Equivalent composition
    - Formulary
    - Generic composition
    - None
    - Therapeutic alternative
    - Therapeutic brand
    - Therapeutic generic

### SupplyDaysCount

- **Type**: double
- **Properties**: Create, Filter, Nillable, Sort, Update
- **Description**: The number of days that the dispensed supply is expected to last.

## Associated Objects

This object has the following associated objects. If the API version isn’t specified, they’re available in the same API versions as this object. Otherwise, they’re available in the specified API version and later.

[MedicationDispenseChangeEvent](https://developer.salesforce.com/docs/atlas.en-us.life_sciences_dev_guide.meta/life_sciences_dev_guide/sforce_api_associated_objects_change_event.htm "A StandardObjectNameChangeEvent object is available for each object that supports Change Data Capture. You can subscribe to a stream of change events using Change Data Capture to receive data tied to record changes in Salesforce. Changes include record creation, updates to an existing record, deletion of a record, and undeletion of a record. A change event isn’t a Salesforce object—it doesn’t support CRUD operations or queries. It’s included in the object reference so you can discover which Salesforce objects support change events.") (API version 59.0)

Change events are available for the object.

[MedicationDispenseFeed](https://developer.salesforce.com/docs/atlas.en-us.life_sciences_dev_guide.meta/life_sciences_dev_guide/sforce_api_associated_objects_feed.htm "StandardObjectNameFeed is the model for all feed objects associated with standard objects. These objects represent the posts and feed-tracked changes of a standard object.")

Feed tracking is available for the object.

[MedicationDispenseHistory](https://developer.salesforce.com/docs/atlas.en-us.life_sciences_dev_guide.meta/life_sciences_dev_guide/sforce_api_associated_objects_history.htm "StandardObjectNameHistory is the model for all history objects associated with standard objects. These objects represent the history of changes to the values in the fields of a standard object.")

History is available for tracked fields of the object.