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
Roberto Cialfi 9Roberto Cialfi 9 

Custom formula field Line manager

Hi Guys,

It is quite a while I do not touch Salesforce so this may be easier than I think. I have a custom object, change request box. I need a field that shows the line manager of the requestor. I thought I could do a formula field as the User object already have a Manager field, so I would just pick that up. However, the only option I see is a ManagerID. There is any way I can get the Manager name instead? When I do the formula field, should not just display an option for it and automatically pick up the line manager from the lookup(user) field I have in the object (requestor)? Thank you :)
Best Answer chosen by Roberto Cialfi 9
srlawr uksrlawr uk
So if I understand right, you have a custom object on which you would like to show the username of the Owners Manager?


A formula field with the value 
 
Owner:User.Manager.Username

Should do it?

If you have a custom user field just do
 
Custom_Field__r.Manager.Username

That should totally work, trust me!

All Answers

Ginny MahantGinny Mahant
Hi,
   You can define a hierarchial custom setting at user level to store the manager name and use that setting in the formula field to get manager's name.

 Hope this helps.
srlawr uksrlawr uk
So if I understand right, you have a custom object on which you would like to show the username of the Owners Manager?


A formula field with the value 
 
Owner:User.Manager.Username

Should do it?

If you have a custom user field just do
 
Custom_Field__r.Manager.Username

That should totally work, trust me!
This was selected as the best answer
Roberto Cialfi 9Roberto Cialfi 9

Hi already have a hierarchical field called 'manager' under User.

Now I have this custom object called 'Change Request'. I want a field with who made the request (Requester, look up to user) and who is their Manager.

When I try this 'Requester__c.Manager.username' the error I have is 'field does not exist'...

Roberto Cialfi 9Roberto Cialfi 9
Ok I was being stupid having __c instead __r :)
SFDC BeginerSFDC Beginer
Go to particular custom object >fileds> create new filed>choose data type as Filed> then Go to advanced formulare >there go to insert> in that you can find many details like role/user/firstanme /last name etc...choose the particular object's details and insert.

It should work