Add a field to a form from which contents come from a function

mtrojahn
Tera Contributor

Hello,

 

I have the need to add to a form a simple read-only textbox to display a string received from a function. I know about dictionaries function fields but that is not exactly what I need because they are bound to be used with "glidefunction:yyyy()" and I need more than that.

 

Here is the context: we have several customers from very different timezones and I want to show their actual time when the user access their account form. I have luxon imported as a UI Script and I can use it freely to convert between timezones. I just need a way to have a textbox (that is not a field on the database) to display this time

Like this mockup

mtrojahn_0-1701275059114.png

 

Is it possible somehow?

 

Let me add that, for now, what I am doing is having a Dictionary Function Field with a script like 

glidefunction:concat("", "")

which concats 2 empty strings and displays the empty textbox. On the page load, there is also a client script that then uses g_form.setValue to set the textbox to the time. This is clearly a very ugly workaround I would like to avoid.

 

 

3 REPLIES 3

Hemanth M1
Giga Sage
Giga Sage

Hi @mtrojahn ,

 

Can you try field message, display mesage right below the timezone field with the time using 

 

g_form.showFieldMsg('field_value',dynamic time,'info');

 

ex:

HemanthM1_0-1701280584504.png

 

 

Accept and hit Helpful if it helps.

Thank you,
Hemanth
Certified Technical Architect (CTA), ServiceNow MVP 2024, 2025

Hi @mtrojahn ,

 

did my response help?  if so,

 

 

Accept and hit Helpful if it helps.

Thank you,
Hemanth
Certified Technical Architect (CTA), ServiceNow MVP 2024, 2025

It could be an option, but that is not what I am required to do. The users want that information to be shown as if it was a part of the form.