UI Macro to Show User's current time & date
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-20-2023 02:17 AM
Hi Team,
I have requirement to add UI Macro to Show the User's current time & date on the Subject Person field in HR Case form.
Appreciate if anyone can help me with the solution.
Thanks in Advance!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-20-2023 03:14 AM
should be an easy task
what did you start with?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-20-2023 03:26 AM
Here is the UI macro HTML code and I hope you know how to add UI macro and show besides reference field
UI macro name: show_loggedInUser_dateTime
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<g:evaluate jelly="true" object="true">
var nowTime = new GlideDateTime();
var str = 'Current date time is ' + nowTime;
str;
</g:evaluate>
<p>${str}</p>
</j:jelly>
Add this in attributes for that field and it will start showing the UI macro
Output:
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader