Skip to main content
added 20 characters in body
Source Link
David Reed
  • 93.7k
  • 14
  • 90
  • 166

Luckily, you don't need to do a loop here because you're using containers that can perform access and membership checking in constant time.

Inside your for loop,

for (ST_Orders__c s2 : [Select id,Approval_Status__c from ST_Orders__c where id in :TargetActorMap.keySet()]) {

you know for sure that s2.Id is a key in TargetActorMap. You can get the Id that is its associated value with TargetActorMap.get(s2.Id). Then, you can find out if that same Id is present in RMUserIds just by doing

RMUserIds.contains(TargetActorMap.get(s2.Id));

Luckily, you don't need to do a loop here because you're using containers that can perform access and membership checking in constant time.

Inside your for loop,

for (ST_Orders__c s2 : [Select id,Approval_Status__c from ST_Orders__c where id in :TargetActorMap.keySet()]) {

you know for sure that s2.Id is a key in TargetActorMap. You can get the Id that is its associated value with TargetActorMap.get(s2.Id). Then, you can find out if that same Id is present in RMUserIds just by doing

RMUserIds.contains(s2.Id);

Luckily, you don't need to do a loop here because you're using containers that can perform access and membership checking in constant time.

Inside your for loop,

for (ST_Orders__c s2 : [Select id,Approval_Status__c from ST_Orders__c where id in :TargetActorMap.keySet()]) {

you know for sure that s2.Id is a key in TargetActorMap. You can get the Id that is its associated value with TargetActorMap.get(s2.Id). Then, you can find out if that same Id is present in RMUserIds just by doing

RMUserIds.contains(TargetActorMap.get(s2.Id));
Source Link
David Reed
  • 93.7k
  • 14
  • 90
  • 166

Luckily, you don't need to do a loop here because you're using containers that can perform access and membership checking in constant time.

Inside your for loop,

for (ST_Orders__c s2 : [Select id,Approval_Status__c from ST_Orders__c where id in :TargetActorMap.keySet()]) {

you know for sure that s2.Id is a key in TargetActorMap. You can get the Id that is its associated value with TargetActorMap.get(s2.Id). Then, you can find out if that same Id is present in RMUserIds just by doing

RMUserIds.contains(s2.Id);