Populate another field in real time; Is this possible using ServiceNow?

Lon Landry4
Mega Sage

Example: In a multilpe line text field a user enters text; simultanously the other field is updated.

This needs to happen in real time as opposed to waiting for the user to click outside of the field with the multi line text.

LonLandry4_1-1707005595270.png

 

Can this be achieved in ServiceNow?

1 ACCEPTED SOLUTION

Narsing1
Mega Sage

You can use this one, but it will only work in Platform side and not Portal.  In order to achieve this in portal, I think need to develop a widget with html textarea & keyup/keydown event.

function onLoad() {
    //Type appropriate comment here, and begin script below
    var control = g_form.getControl('comments');
    control.onkeyup = copytext;
}
function copytext() {
	g_form.setValue("comments_1", g_form.getValue("comments"));
}

 

Thanks,

Narsing

View solution in original post

2 REPLIES 2

Narsing1
Mega Sage

You can use this one, but it will only work in Platform side and not Portal.  In order to achieve this in portal, I think need to develop a widget with html textarea & keyup/keydown event.

function onLoad() {
    //Type appropriate comment here, and begin script below
    var control = g_form.getControl('comments');
    control.onkeyup = copytext;
}
function copytext() {
	g_form.setValue("comments_1", g_form.getValue("comments"));
}

 

Thanks,

Narsing

Works great!

Thanks for the help, I look fowrward to trying to make this work in portal with a widget as mentioned.