I am trying to remove an item from a list but i have something wrong in my syntax. I am getting error:
Method does not exist or incorrect signature: [List<User>].remove(Id)
Trigger Code:
trigger User on User (after insert, after update) {
Public List<ID> HubsToReactivate = new list<ID>();
Public List<ID> HubsToCreate = new list<ID>();
List<User> users = new list<User>();
//Handle new user creation and reactivation of inactive users.
if(trigger.isInsert || trigger.isUpdate){
For(User u: Trigger.new){
users.add(u);
}
// Task 1 - Check for existing hubs
List<BCS__c> findHubs = new list<BCS__c>([
SELECT Id, Name, Title__c, User__c
FROM BCS__c
WHERE User__c IN :users
]);
//Reactivate found hubs for users
for(BCS__c b:findHubs){
HubsToReactivate.add(b.Id);
}
//Create Hubs for new users.
List<User> newUsers = users.clone();
//Remove anyone who we already found a BCS__c record for above.
for(BCS__C b:findHubs){
newUsers.remove(b.User__c);
}
//Call Future Method for DML operation
future_New_User_Setup.reactivateHubs(HubsToReactivate);
future_New_User_Setup.createHubs(HubsToCreate);
}
}
Map<Id, User>
instead.