You need to sign in to do that
Don't have an account?
LIM AI KHOON
Get data from map
Hi, in user map have id and name. This code is to check if userMap contains the name from field HOT__C, so the ID from the map will be the owner ID.
The thing is, this code will take the last id from the map, not take the id according to the checking name. May I know how to fix this?
The thing is, this code will take the last id from the map, not take the id according to the checking name. May I know how to fix this?
Map<Id, User> userMap = new Map<Id, User>([SELECT Id, Name FROM User where UserRole.name like'HO%']); for (User u : userMap.values()) { for (Centive__c centive: Trigger.new) { if(u.Name.contains(centive.HOT__c)){ centive.OwnerId = u.id; } } }