UI Page Dialog window Size

Surbhi Srivasta
Tera Expert

Hi,

I have created a UI Page where I am dynamically displaying the data in my UI Page.

So far I have been able to get the data displayed in my UI Page, but the problem which I am facing is regarding the size of the popup.

Based on content how can I make it auto fit to the content? Right now for some it is showing properly but for some it's going out of Browser window size.

 

My code below:

I am populating Description from Client script of my UI page to HTML based on help done by Ankur. Below is my code:

 

UI Page HTML:

<div>
		<b>Description</b>
		<br/>
		<br/>
		<pre><p id="description"></p></pre>
		
	</div>

 

UI Page Client Script:

populateDetails();

function populateDetails() {
    var getDetails = new GlideAjax('SI Name');
    getDetails.addParam('sysparm_name', 'Function Name');
    getDetails.addParam('sysparm_recordID', g_form.getUniqueValue());
    getDetails.addParam('sysparm_record_table', g_form.getTableName());
    getDetails.getXMLAnswer(getDetails);
}

function getDetails(answer) {
    var parseEmail = JSON.parse(answer);
    document.getElementById('description').innerHTML = parseEmail.body;
}

 

8 REPLIES 8

Ankur Bawiskar
Tera Patron
Tera Patron

@Surbhi Srivasta 

set the size

  var dialog = new GlideDialogWindow("sc_cat_item_disclamer"); //create "Terms and Conditions" dialog window

   dialog.setTitle(getMessage('disclamer_title')); //Set the dialog title

   dialog.setSize(600,600); //Set the dialog size

   dialog.removeCloseDecoration(); //remove the close cross from the dialogwindow

   dialog.render(); //Open the dialog

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

Hi @Ankur Bawiskar 

 

The suggested method did not worked for me. It is still not automatically adjusting based on the content and is going outside the page.

 

Any other alternative suggestions from your end?

@Surbhi Srivasta 

how does it look like?

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

Hi @Ankur Bawiskar 

Unfortunately, due to client restrictions I will not be able to share the image here.

But after trying your script, there was no change in size of the dialog box, exactly same as before.

 

What I am looking for is to auto adjust the dialog box size based on the content which we are trying to display.

Any input on this?

 

Regards,

Surbhi