This article explains why a record-triggered Flow fails with "FIELD_CUSTOM_VALIDATION_EXCEPTION: This event refers to a visit. Due to visit validation, it cannot be changed." when it tries to update an Event [Event] record linked to a Visit [cgcloud__Visit__c] in Consumer Goods Cloud, and how to redesign the automation so the update succeeds.
Customers describe this as: "Flow fails when trying to update the Event record — error element: updateVisit (FlowRecordUpdate), error type: FIELD_CUSTOM_VALIDATION_EXCEPTION" and "After-create Flow updates an Event linked to a Visit but the update is blocked by hidden Consumer Goods Cloud managed logic, most likely the managed cgcloud EventTrigger".
Trigger conditions:
- A record-triggered Flow on the Event object runs after create or update.
- The Event has its WhatId field set to a Visit [cgcloud__Visit__c] record.
- The Flow (or a subflow) executes a Record Update element against that Event.
- The managed trigger [cgcloud.EventTrigger] (namespace cgcloud, package: Consumer Goods Cloud) raises the validation error during the AfterUpdate phase.
There is no custom Validation Rule on the Event object that produces this message; the restriction is enforced inside the managed package code and is intentional — once an Event is associated with a Visit, the package treats the Event as part of the Visit's locked record set so that Visit validation, scheduling, and signature integrity are preserved (consistent with the Visit lock behaviour documented for Consumer Goods Cloud and the analogous VisitLockHandler / VisitValidationHandler pattern in the Salesforce field execution model).
A related failure mode is "CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY: cgcloud.EventTrigger: execution of AfterUpdate caused by: System.NullPointerException" when the Flow updates the WhatId of an Event from null to a Visit Id in the same transaction; the managed trigger references the prior (null) WhatId and the update fails.
Affected editions: Lightning Experience in Professional, Enterprise, and Unlimited editions with Consumer Goods Cloud enabled and the cgcloud managed package installed.
Do not attempt to update an Event record after its WhatId points to a Visit. The managed [cgcloud.EventTrigger] enforces visit validation and will reject the DML. Redesign the automation using one of the two patterns below.
Use a before-save flow that sets Event field values in the same transaction that creates the Event, so no second DML against the linked Event is needed.
Move the field value to a custom field on the Event that the managed trigger does not protect, or perform the update before WhatId is set to a Visit.
This surfaces as "CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY: cgcloud.EventTrigger: execution of AfterUpdate caused by: System.NullPointerException". The managed trigger reads Trigger.old.WhatId and the prior value is null.
Confirm the issue is resolved by reproducing the original failure: create a new Event whose WhatId references a Visit and trigger the redesigned automation. The Event must be created (or its field set) without raising "FIELD_CUSTOM_VALIDATION_EXCEPTION: This event refers to a visit. Due to visit validation, it cannot be changed." and the Flow interview must complete with status Finished.
005385137

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.