Not getting user full name by using getDisplayName() in Business Rule
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-15-2016 09:40 AM
Hi All,
I want to display the user's full name instead of User id in Created by field for sysapproval_approver table only for Knowledge approvals. Hence i am writing below one line in My BR:
<<current.sys_created_by = gs.getUserDisplayName();>>
But while checking in Background script, i am not getting the user's name by using getDisplayName(). It is coming as undefined.
I am using the below script for background check :
var kb = new GlideRecord('sysapproval_approver');
kb.addEncodedQuery('document_id=sys_id^source_table=kb_knowledge');
kb.query();
if(kb.next()){
gs.print(kb.sys_created_by.getDisplayName());
}
Can anybody tell me what is the issue here?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-16-2016 04:13 AM
Hi,
Happy to hear. Please mark the question as answered.
Thanks !
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-16-2016 04:14 AM
I used the same code in BR and its not updating the record..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-16-2016 09:56 AM
Hi,
Can you paste the BR code.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-19-2016 01:04 AM
It worked after using below code:
current.sys_created_by = gs.getUserDisplayName();
Thanks all for your help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-19-2016 01:47 AM
Hi,
Happy to hear !
Please mark this thread as answered.