If you want to know the name of the users then:
//this contains all the LastModifiedById values you need
Set<Id> userIDs = new Set<Id>();
List<User> modUser = [SELECT Name FROM User WHERE Id IN: userIDs];
and this is an example of where I used it
trigger Suscripcion_ActualizaCortesiaAutoriza on Opportunity (before update) {
List<Opportunity> listaOpp = new List<Opportunity>();
for(Opportunity opp : trigger.new){
if(string.isBlank(string.valueOf(opp.SFID__c)) &&
opp.Autoriza__c == 'Blanca Nelly Garcia Gonzalez'){
listaOpp.Add(opp);
}
}
Set<Id> setOpp = new Set<Id>();
Set<Id> aprobadorId = new Set<Id>();
if(!listaOpp.isEmpty()){
for(Opportunity opp : listaOpp){
if(opp.Cortesia_Autorizada__c){
setOpp.add(opp.Id);
}
}
ProcessInstance[] pi = [SELECT Id, TargetObjectId,
(SELECT actorId, stepStatus FROM Steps)
FROM ProcessInstance
WHERE TargetObjectId IN: setOpp
AND Status = 'Approved'];
for(ProcessInstance p : pi){
for(ProcessInstanceStep step : p.steps){
if(step.StepStatus == 'Approved'){
aprobadorId.add(step.ActorId);
}
}
}
if(!aprobadorId.isEmpty()){
User aprobador = [SELECT Name FROM User WHERE Id IN: aprobadorId LIMIT 1];
for(Opportunity opp : listaOpp){
String nombre = '';
for(ProcessInstance p : pi){
if(opp.id == p.TargetObjectId && opp.Autoriza__c == 'Blanca Nelly Garcia Gonzalez'){
nombre = aprobador.Name;
break;
}else{
opp.Autoriza__c = 'falso';
break;
}
}
if(nombre != ''){
opp.Autoriza__c = nombre;
}
}
}
}
}
Profile
table already contains this information. – Phil Rymek Oct 6 '13 at 14:32