OOB Field sys_created_by to display "First Name + Last Name"

Dhruv Chandan
Giga Guru

Hi All,

Our requirement is to make the "sys_created_by" field display the "First Name + Last name", instead of the User ID.

The dictionary entry for the same isn't editable. Is there a way to alter the behavior as per the requirement stated above?

Regards,

Dhruv Chandan

6 REPLIES 6

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Dhruv,



It seems difficult to achieve this since that field is controlled by system itself. Try exploring much. But I would recommend not to do this since it might affect the entire instance and may have adverse effects not sure at what all places.



Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.


Thanks


Ankur


Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Aakash Shah4
Tera Guru

Hi Dhruv,



Hope this article will clear your doubts



How to change display name for 'updated by'



Shiva Thomas
Kilo Sage

Hi Dhruv,



I agree with Aakash and I'll copy here my response from this previous post, slightly updated for your question: How to change display name for 'updated by'



Just a warning... The field 'sys_created_by' is not a reference to the client table, and don't contain a sys_id. It's a simple string, probably for performance reason. It's a very low level field for the platform. If you modify its behavior, you may suffer from unexpected side-effects later on.



I strongly recommend that you leave this field for the system, and create a new one for your own usage.   You can create a custom 'u_created_by' field.



This example uses updated_by instead of created_by, but the logic is similar. I created a field 'u_updater' on the Task table. Set it read-only. Created a business rules run on insert & updates to set the 'u_updater' field. I preferred to use a different name to avoid possible confusion.



The   code you want to use one is this:


javascript: gs.getUserDisplayName(); // Will return the display name 'Shiva Thomas'


Capture d



Here is the result...



Capture d




You could also use a reference string, pointing to the user table, and setting it with gs.getUserID(); but I'm not sure of the performance impact on your instance. I suppose there is a reason why ServiceNow did not implement 'sys_created_by' it that way.


randrews
Tera Guru

i would try VERY hard to talk the business off the ledge and NOT do this... if they absolutely insist they HAVE to have it... i still wouldn't do it...



that is an OOB field and you do NOT want to mess with it...



what i WOULD do for them.. is make the sys_created_by not readable to anyone NOT an admin...


then i would create a NEW created by field on the task table.. u_created_by and do an on insert business rule that populates it how you want.. and expose THAT field to them.