Getting Created By 'name' of sys_created_by on sysapproval_approver table

xiaix
Tera Guru

For System Notifications, on the sysapproval_approver table.

The field, "Created By"   (sys_created_by), is a string field, not a reference.

The Created By displays the "user_id" of the user, instead of their "name".

How can I get the name?

In the body of the email I have:

Created By:   ${sys_created_by.name}     =     of course since this isn't a reference field, it returns nothing.

Created By:   ${sys_created_by}     =     this returns the user_id, like   489593

Can I use the good 'ole getReference() function in an email notification?

1 ACCEPTED SOLUTION

Abhinay Erra
Giga Sage

You can use use mail script and put this script in there



template.print(gs.getUser(). ­getUserByID(current.sys_created_by).getDisplayName());


View solution in original post

18 REPLIES 18

Yes, getUser() methods always come in handy.


Why do you need getUser() followed by getUserByID()?   Don't both get you the entire user object?


We need getUserByID() in the cases where the created by is a different user from the logged in user. If we use gs.getUser().getDisplayName(), it would get the display name of logged in user.


Right, but both get a User object, right?   So why have both, simultaneously?


Yes, both get a user object. When you say why use simultaneously, you mean do something like this instead of that


var ourUser = gs.getUser();


ourUser = ourUser. ­getUserByID( ­'abel.tuter');


gs.print(ourUser.getDisplayName());