You are here:
Visit Locking and Unlocking
Visit locking prevents changes to submitted and signed visits and their related records so that audit data remains accurate. Visits and related records lock differently when a field user captures a signature and when a field user submits a visit. Understanding how locking works helps you determine the fields and records that users can update when they unlock visits.
Required Editions
| Available in: Lightning Experience |
| Available in: Enterprise and Unlimited Editions with Life Sciences Cloud, Life Sciences Cloud for Customer Engagement Add-on license, and the Life Sciences Customer Engagement managed package. |
Set Up Visit Locking
To configure locking and unlocking for visits, complete these steps.
- Activate VisitLockHandler in Trigger Handler Administration in the Admin Console. See Activate Trigger Handlers.
- Turn on Unlock submitted visit in Visit Settings. Configure the setting for the org default, specific user profiles, or individual users, depending on who needs permission to unlock visits. See Configure Visit Settings.
- Add the Unlock quick action to the visit record page. The button doesn't change based on the visit's status, so configure visibility rules to show it only for submitted visits. See Configure Quick and Custom Actions and Add Actions with Dynamic Actions.
How Visits Lock on Signature Capture
Capturing a signature locks these fields on the signed visit record permanently.
- Place
- Account
- Signature Type
- Record Type (only if your org has record types configured on the Visit object)
Capturing a signature for any visit in a group visit locks the Place, Account, and Record Type fields for all visits in that group. Signature Type locks only on the visit where field users captured the signature.
These fields remain read only even after a field user unlocks the visit. To confirm whether the visit has a signature, check for a value in the Signature Type field on the visit record.
How Visits Lock on Submission
When field users submit a visit and its status changes to Completed, the VisitLockHandler trigger handler locks the entire record. All fields become read only.
Submitting a parent visit also submits all child visits in the group and locks all of these visits and their related records.
How Related Records Lock
Signing or submitting a visit also locks records related to that visit. Which fields lock depends on the related record and how the visit locked. For some records, locking on signature capture applies only when the associated Life Science Marketable Product record's signature requirement level is mandatory or optional.
This table shows how each related record locks on signature capture and on submission.
| Record | On Signature Capture | On Submission |
|---|---|---|
| Attached files and documents in Content Document and Content Document Link records | Not locked | All fields lock |
| Expense | Not locked | All fields lock |
| Expense Participant | Not locked | All fields lock |
| Presentation Forum | Not locked | All fields lock |
| Product Disbursement | All fields lock if the product's signature requirement is mandatory or optional | All fields lock except for Resolution Required and Inventory Count Reference ID |
| Provider Visit | Only the Physical Form Identifier field locks | All fields lock, and users can't edit or delete records |
| Provider Visit Detailing Product Message | All fields lock if the product's signature requirement is mandatory or optional | All fields lock |
| Provider Visit Marketing Item | All fields lock if the product's signature requirement is mandatory or optional | All fields lock |
| Provider Visit Product Detailing | All fields lock if the product's signature requirement is mandatory or optional | All fields lock |
| Provider Visit Product Discussion | All fields lock if the product's signature requirement is mandatory or optional | All fields lock |
| Provider Visit Requested Sample | All fields lock if the product's signature requirement is mandatory or optional | All fields lock |
| Visitor | Not locked | All fields lock |
How Locks Apply to Migrated Data
If you plan to migrate historical visit data into your Salesforce org, temporarily turn off the VisitLockHandler trigger handler before you import records. After you import, turn on the handler again to apply it to all records that meet the signed or submitted criteria, including the migrated records.
How Visits Unlock
Unlocking a visit resets its status from Completed to Planned. Users can edit all fields except for Place, Account, Signature Type, and Record Type, which lock permanently on signature capture. The visit's related records also unlock. Fields on related records that locked on signature capture remain read only.
After field users edit the visit, they submit it again to lock the record. There's no separate Lock button, because locking happens automatically on submission.
Keep these considerations in mind.
- Unlocking a parent visit also unlocks all child visits in the group. Field users can't unlock child visits independently.
- No field on the visit record indicates whether the visit is locked. The VisitLockHandler locks the visit when its status is Completed.
What Prevents Visit Unlocking
Visit unlocking isn't supported in the Life Sciences Cloud mobile app. To unlock the visit, select View Online to open the record on the desktop site.
Field users can't unlock a visit when any of these conditions apply.
- A sample transaction for the visit was reconciled as part of a sample inventory assessment.
- The setting for unlocking submitted visits is turned off in Visit Settings.
- The field user doesn't have edit access to the visit.
- The field user doesn't have read access to product disbursement records.
- The visit is an attendee visit. Unlock the parent visit to unlock all its attendee visits.
Field users can't unlock the visits with product disbursements or requested samples when these conditions apply.
- A sync is pending for the field user's product disbursement or direct-to-patient sample limit transaction.
- An account merge or sample limit background job is running.
