UI Macro to Show User's current time & date

Namita_Snow
Tera Expert

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!

2 REPLIES 2

Ankur Bawiskar
Tera Patron
Tera Patron

@Namita_Snow 

should be an easy task

what did you start with?

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Ankur Bawiskar
Tera Patron
Tera Patron

@Namita_Snow 

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>

UI Macro in ServiceNow 

Add this in attributes for that field and it will start showing the UI macro

AnkurBawiskar_1-1697797595251.png

 

Output:

 

AnkurBawiskar_0-1697797521434.png

 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader