function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
GeorgeLiangGeorgeLiang 

Autolaunched Flow to Remove AccountShare record on Update of the Secondary_Owner__c custom field

Instead of Managed Sharing through Apex, I used flow to share Account records via Flows.
I would like to share the record with another user via the Secondary_Owner__c field in Account. I also want the sharing to be dynamic when it comes to update or deletion of the value in the lookup field. For instance, if Secondary_Owner__c is John Doe and it is changed to Jane Doe, I want the AccountShare record to be removed and add Jane Doe.
I have two flows in a Process Builder (PB). 1st flow gets and removes all AccountShare records where rowCause=Manual. 2nd flow adds the AccountShare record based on Secondary_Owner__c field. The PB conditions are when the Secondary_Owner__c is changed & not blank.
Individually, each flow works. However, when there are no AccountShare records in the get part of the 1st flow, it errors out and the rest of the flows break. Any idea on how to handle the error?


Flow API Name: Delete_Current_AccountShare_Ids Type: Autolaunched Flow Version: 1 Status: Active Org: Wedbush Securities (00D1I000001f2ry) Flow Interview Details Interview Label: Delete Current AccountShare Ids 3/3/2020 1:34 PM Current User: George Liang (0051I000004xz2w) Start time: 3/3/2020 1:34 PM Duration: 0 seconds How the Interview Started George Liang (0051I000004xz2w) started the flow interview. FAST LOOKUP: Get_Current_AccountShare_Ids Find all AccountShare records where: AccountId Equals {!AccountIDs} (null) RowCause Equals Manual Store the values of these fields in Get_Current_AccountShare_Ids: Id, RowCause Result Failed to find records. FAST DELETE: Delete_AccountShare_Ids Delete AccountShare records whose IDs are stored in {!Get_Current_AccountShare_Ids}. Variable Values None. Result Failed to delete records whose IDs are in {!Get_Current_AccountShare_Ids}. Error Occurred: No records in Salesforce match your delete criteria.
GeorgeLiangGeorgeLiang
Bump