Pop-BOX

aggarwaltan
Tera Contributor

when I click on Submit button a pop box should come which contains the user Title . 

4 REPLIES 4

swati swagatika
Tera Contributor

You can use UI Page for it

 

can I get the solution for it :- 

function getReference(id) {

   // Get reference to the element with the specified ID

   return document.getElementById(id);

}

 

function onSubmit() {

   // Use the getReference method to retrieve the element

 const callerTitleElement = getReference("callerTitle");

 

   // Access the value or provide a default message if the element is not found

   const title = callerTitleElement ? callerTitleElement.value : "No Title provided";

 

   alert("Caller Title: " + title);

}

when I use this get the error in Service now is it possible for you to make it correct 

What kind of  error you are getting?? and what you want to achieve can you please explain a little?

Anand Kumar P
Giga Patron
Giga Patron

Hi @aggarwaltan ,

 

You can use below script:

function onSubmit() {
 g_form.getReference('caller_id',function(caller){
	if(caller && caller.title){
		alert("Caller titile:"+caller.title);
	}else{
		alert('No caller title');
	}
 });
 return true;
}




AnandKumarP_0-1730271604388.png

 

Mark it as helpful and solution proposed if it serves your purpose.
Thanks,
Anand