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
thuskerthusker 

Trying to pull Opportunity Owner "user record" field value into opportunity page

Hello . . . hoping someone can provide some suggesttions to work around an issue I'm having.  Basically, what I need to do is to have a field on an opportunity that can display a value from a field on the Opportunity Owner's SFDC user record.   I will need that field for a few different things like reporting and also to be used for routing in a approval process.  The issue is that I would expect that user record field to be readily available through a formula.  But it's not. Each SFDC user has a "User Theater" field on their user record.  This is the field I need to display/use on the opportunity.

 

If I try to create a formula field on the opportunity, I get to the "insert field" section and when I drill down I can't get to the opportunity owner's user record.  The only Owner field I can get to is the Owner ID.  I need to use a field on the opportunity owner's user record. 

 

I can get to the "Created By" user record for the field I need.  I can also get to the "Last Modified By" user record for the field I need . . . so why can't I get to the actual opportunity owner's user record for the field???  Created by and Last Modified by in many cases may not provide the valid info--I really need it to be based on the opportunity owner's info.

 

Is there any way at all to make this available on the opportunity?  I'm not a developer . . . I can't write triggers.  I'm hoiping there is a way to get to this data that is doable for me to implement.  Any assistance would be great!

 

 

SwarnasankhaSwarnasankha

I am afraid there is no work around using the standard functions. What you can do however using a little bit of coding is to first create a custom Lookup field to User named "Opportunity Owner" on Opportunity and have a populated using a trigger which would fire whenever a Opportunity Owner changes. Once the custom lookup is populated, you can use formula fields on Opportunity to refer to any fields on the User record.

 

The trigger would be as follows:

 

trigger getOppOwnerName on Opportunity (before insert, before update)
{
    for (Opportunity o: trigger.new)
        {
        if(trigger.isInsert)
            {
                o.Opportunity_Owner__c = o.OwnerId;
            }

        if(trigger.isUpdate)
        {
            if(trigger.oldmap.get(o.Id).OwnerId != o.OwnerId)
            {
                o.Opportunity_Owner__c = o.OwnerId;
            }
        }
    }
}

 

Hope this helps.