I have to get subset of users who do not have records in custom table last modified in last 15 minutes. Here is my code:
string query = 'Select Id FROM MyCustomObject__c where LastModifiedDate > ' + Datetime.now().addMinutes(15);
List<MyCustomObject__c> sobjList = Database.query(query);
List<String> userIdsToRemove = new List<String>();
for (MyCustomObject__c dataGrid :sobjList)
{
userIdsToRemove.Add(dataGrid.Id);
}
List<User> allUsers = [select Id FROM User WHERE Profile.UserLicense.Name IN ('Salesforce','Salesforce Platform') AND
IsActive=TRUE];
for (User u :allUsers)
{
if (!userIdsToRemove.contains(u.Id))
{
usersToUpdate.Add(u);
}
}
I get the following error: Error: Compile Error: Method does not exist or incorrect signature: [List].contains(Id) Why is my code complaining about contains()? Is there a way to optimize this code