- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-12-2017 02:26 PM
Hi everyone
So I've been trying with out much luck to get an automatic signature appearing in emails sent from the in built service now email client.
I've been using Client Templates to set the template for the incident table and while I can use a mail script to add in text I can't seem to get values from the g_user object.
The code I have in the template just now.
Kind regards,
<mail_script>
template.print(g_user.userName);
</mail_script>
When opening the client I simply see the following:
I've put in a string value to the template.print call and that prints out OK so I'm lead to believe that g_user simply isn't returning a value.
Is anyone able to help me shed some light on why g_user is not returning a value or should I be using a different method to retrieve the current user?
Kind regards,
Robert
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-12-2017 02:34 PM
Hi Robert,
Try below script:
<mail_script>
template.print( gs.getUser().getFullName() );
</mail_script>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-12-2017 02:34 PM
Hi Robert,
Try below script:
<mail_script>
template.print( gs.getUser().getFullName() );
</mail_script>

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-12-2017 02:38 PM
Can you please try with : gs.getUserName();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-12-2017 03:00 PM
Hi Shishir
That worked. not sure why as I'd tried that before and simply got 'undefined' as an output.
It's working this time though
Thank you very much,
Robert
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-15-2017 09:43 PM
Hi Robert,
g_user objects are client side user objects whereas mail script is server side. To get user values, we have to leverage gs.getUserID, and other server side user objects. thats the reason, your script did not return a value
Hope this was informative