An effort to bring a revolution in Salesforce.

Friday, 25 September 2015

Salesforce trigger for Convert Lead Owner Queue to Logged in User !!

Salesforce trigger  for Convert Lead Owner Queue to Logged in User


trigger leadConvertToLoggedInUser on Lead (before update) {
   User u = [select Id, Name from User where Id =: UserInfo.getUserId()];

   for(Lead Ld : Trigger.New){  
           String leadOwner = Ld.OwnerId;
           if(leadOwner.startsWith('00G')){
               Ld.OwnerId = u.Id;
           }
   }

}
,

No comments:

Post a Comment

Get Gmail, Docs, Drive, and Calendar for business