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

Ok, assuming you're using a notification record instead of a Workflow Notification activity, you could build a mail script that takes the created_by and does a gliderecord lookup on the user table to find the name.   Then you just call the mail script within the notification record.



You probably have this already worked out, but how are your approvals linking to the non-task record in question?


And if your Approval records are all created via workflow, don't you want the CreatedBy of the originating record?  


Approvals are linking to the non-task extended table because the workflow is putting the record sys_id into the "Approving" (document_id) field on the sysapproval_approver table.



The approval emails work perfectly for Approving or Rejecting the request.   It's awesome.


Kalaiarasan Pus
Giga Sage

Tried ?



${sysapproval.opened_by.name}


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());


*WAY* better than my gliderecord lookup idea