Loading

Consumer Goods Cloud: scheduled Flow on User or Visit fails with cgcloud.CustomException from managed UserTrigger or VisitTrigger

Publish Date: May 27, 2026
Description

The triggers can thorw cgcloud.CustomException when
(1) the running user (typical for scheduled Flows: the system context user, or for integrations: the Salesforce Integration user) does not hold the Lightning Retail Execution permission set license and the CGCloud Business Admin or CGCloud Retail Business Admin permission set, or
(2) the cgcloud__Trigger_Setting__c custom setting contains duplicate rows because the post-install batch was run more than once.
(3) cgcloud__Completed_Date__c

Resolution

Cause 1: Running user is missing the required CGCloud permission set license
1. Identify the user context that runs the scheduled or record-triggered Flow. For a schedule-triggered Flow, this is the user shown in Setup > Flows > [Flow Name] > Edit > Start element > Run As. For an integration update, it is the Salesforce Integration user calling the REST API.
2. Navigate to Setup > Users > Users > [Username] > Permission Set License Assignments.
3. Click Edit Assignments and select Lightning Retail Execution. Click Save.
4. Navigate to the same user record > Permission Set Assignments > Edit Assignments.
5. Add CGCloud Business Admin or CGCloud Retail Business Admin to Enabled Permission Sets. Click Save.
6. For integration users, if no spare Lightning Retail Execution license is available, deassign it temporarily from another user to test, then purchase an additional license through your account executive.

Cause 2: Duplicate rows in the cgcloud__Trigger_Setting__c custom setting
1. Open Developer Console > Query Editor and run: SELECT Id, Name FROM cgcloud__Trigger_Setting__c
2. Identify rows where Name is duplicated (commonly index 33 in the System.ListException message corresponds to a duplicated Trigger Setting record).
3. Navigate to Setup > Custom Settings > Trigger Setting [cgcloud__Trigger_Setting__c] > Manage > View All.
4. Delete one of each duplicate Name pair. Keep one record per Name value.
5. Verify only one of the post-install batches was run. The Consumer Goods Cloud post-install steps require running either the batch in Step 4 OR the batches in Steps 5 (Retail data) and 6 (Sync data) — never both. Running both creates the duplicates.

Cause 3: cgcloud.VisitTrigger overwrites cgcloud__Completed_Date__c set by custom code
1. The managed Visit trigger sets cgcloud__Completed_Date__c to PlannedVisitStartTime.date() during the Visit lifecycle. If there are any before-save Flows or Apex that set this field earlier in the same transaction are overwritten.
2. Move the custom assignment to an after-save automation that runs after the managed trigger completes. Navigate to Setup > Flows > New Flow > Record-Triggered Flow > Object: Visit [cgcloud__Visit__c] > Trigger: A record is updated > Optimize the Flow for: Actions and Related Records.
3. Use this after-save Flow to assign cgcloud__Completed_Date__c to the required value. Activate the Flow.

Knowledge Article Number

005385223

 
Loading
Salesforce Help | Article