+ Start a Discussion

Mapping Fields - Auto Populate

On the Leads tab, I created a field named "Salesperson".  I would like this field to auto populate the name in the Lead Owner field. I don't know how to map two fields on the Leads Tab.  Can anyone please help? 




You need to create a formula field to achive this. By using formula field, you will be able to retrieve ownerid in the salesperson field.


Hope this helps.


You can create a trigger to do that.


here an example:


//The trigger declaration - this will fire before inserts abd updates to Leads

trigger LeadRegin on Lead (before insert, before update) {


  // iterate through each Lead record in the input batch

  for (Lead l : Trigger.New) {


    // Fetch from the DB the User record that is the owner

    User theOwner = [SELECT I, Region__c FROM User WHERE Id = :l.ownerId];


    // Set the REgion field of the Lead to the REgion field of the owner

    l.Region__c = theOwner.Region__c;