function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SueHallSueHall 

Cross object formula - Pulling over Opportunity Owner

Does anyone have a solution for pulling over the owner of a record from a standard object to a custom object? 
Tried using the cross object formula but it only pulls the owner ID and I am looking for the actual owner name.  My users are looking for the field to "auto-populate" rather than have to use a look up.  Any thoughts?

Example:
Opportunity Owner - need to pull the owner name into a custom object
The two objects currently share a master-detail relationship with the opportunity as the master
JakesterJakester
That sure is unfortunate that it's not available! Here's an untested idea for an (admittedly lame) workaround: create a new lookup field to the User table, call it something like Owner_Lookup__c, and then create a workflow rule that fires any time the Owner is changed to write the OwnerID to that field. Then use the Owner_Lookup__c to pull in the user's name. It's ugly, but it's only thing I can think of. You could remove the Owner_Lookup__c from the page layout.
Rob Lofaro.ax214Rob Lofaro.ax214

Unfortunately this does not work because the Workflow field update does not allow you to specify the Record Owner in the lookup field update.  For User Lookup fields in workflow updates, you can only pick a specific user, not reference the record owner.

:-( 

TMAWSRTMAWSR

Has anyone figured out a more elegant solution? My hack around involves nested if statements that populates the name based on the USER ID.

Anything better?

puneet28puneet28

I got a solution for this but its very similar to solution provided by @Jakester  except it'll have an apex trigger instead of workflow rule.

 

I did this on my account object.

 

Steps:

1) Make a Lookup(User) on Account:  Owner_Copy__c

2) Apex Trigger:

trigger ownerRole on Account (before Insert, before Update) {

for(Account a : Trigger.New){
a.Owner_Copy__c = a.OwnerId;
}
}

 

3) Next a Formula Field: 

Account Owner Role (Text) = Owner_Copy__r.FirstName