The CreatorCon Call for Content is officially open! Get started here.

Confirmation Dialog box - No alert - client script

Khanna Ji
Tera Guru

Hi All,

I have a catalog client script in which I am making Ajax calls to the Script Include. That script includes checks some data in the tables and returns the output to the client script. Now in the catalog client script, I have to show that response as a message box in the Service Portal.

I am able to show it as an alert statement but it looks really dirty. How can I generate a message box and show the content in it?

I found an article but I am not sure how to use them in client script - Link Here

Thank you, appreciate your response.

20 REPLIES 20

Not useful. Can you try them and share the code snippet?

Just try with the hardcoded value "Welcome Message"

Show this message on the Portal in onSubmit catalog client script. 

Yes,why not.let me try it on my instance

Regards

Yash Agrawal

Alok Das
Tera Guru

Hi,

Could you please have a look on the below link and give a try.

dialog window in client script - alternative for service portal needed

Regards,

Alok

He ended up creating a widget and showing that winget. It's not a dialog box.

Hitoshi Ozawa
Giga Sage
Giga Sage

Try the following:

  1. From Application Navigator. "System UI" > "UI Page"
  2. Create new UI Page

HTML

<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
  <table width="300">
	<tr><td>Just letting you know that something happened.</td></tr>
	<tr><td>Nothing to worry about...</td></tr>
	</table>
	<br />
	<table width="300">
    <tr><td><button class="btn btn-default" id="cancel_button" onclick="window.GlideModalForm.prototype.locate(this).destroy(); return false" style="width:100%;background-color:#008477;color:white;font-weight:bold;" title="" type="submit">OK</button></td></tr>
  </table>
</j:jelly>

3. Then in Client Script on Catalog (need to replace name of GlideModel with name of UI Page created above.

    try {
        var gm = new GlideModal('Sample dialog'); // replace "Sample dialog" with of UI Page create above.
        gm.setTitle('Info Alert');
        var title = gm.getPreference('title');
        gm.setWidth(350);
        gm.render();
    } catch (err) {
        var modalInstance = spModal.alert('<h3>Info Alert</h3><hr/>Just letting you know that something happened.<br/>Nothing to worry about...').then(function() {
        });
    }