Skip to content

Commit

Permalink
Merge pull request #7273 from SalesforceFoundation/feature/256__W-151…
Browse files Browse the repository at this point in the history
…97089-tdtm-exception-self-deactivate-flow-inactive-user

W-15197089 - Handle TDTM Exception for Self-Deactivation of Inactive Users
  • Loading branch information
screcco-sfdo authored Dec 17, 2024
2 parents 740d2b5 + c761c3d commit 0d0ac57
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions force-app/tdtm/classes/TDTM_ObjectDataGateway.cls
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,18 @@ public without sharing class TDTM_ObjectDataGateway implements TDTM_iTableDataGa
**/
public static List<SObject> getClassesToCallForObject(String objectName, TDTM_Runnable.Action action) {
String strAction = action.Name();
String currUserName = UserInfo.getUserName();
String currUserName;
try{
currUserName = UserInfo.getUserName();
}catch(Exception e){
currUserName = null;
}
List<SObject> listClasses = new List<Sobject>();
for (Trigger_Handler__c th : listTH) {
Set<String> excludedUserNames = (th.Usernames_to_Exclude__c != null ?
new Set<String>(th.Usernames_to_Exclude__c.toLowerCase().split(';')) : new Set<String>());
if (th.Object__c == objectName && th.Trigger_Action__c != null && th.Trigger_Action__c.contains(strAction) && th.Active__c == true
&& !excludedUserNames.contains(currUserName.toLowerCase())) {
&& (currUserName != null && !excludedUserNames.contains(currUserName.toLowerCase()))) {
listClasses.add(th);
}
}
Expand Down

0 comments on commit 0d0ac57

Please sign in to comment.