Please help with creating a line break using GlideModal.

Erica2
Tera Contributor

 

Hello, 

 

I have a catalog client script that displays a message when a variable changes.

I'm trying to insert a new line in the Title between 'the' and 'IT Service Desk,' but I can't figure out how to do it.

 

 

Erica2_1-1730325126182.png

 

This is not a complete code.  Thank you

 

gm.setTitle("Task Closure and New Assignment");
        gm.setPreference("title", "This task will be closed, and a new one will be created and assigned to the IT Service Desk. Would you like to proceed with this?");
        gm.setPreference("warning", "false");
        gm.setPreference("onPromptComplete", function() {
}

 

 

 

2 ACCEPTED SOLUTIONS

Runjay Patel
Giga Sage

Hi @Erica2 ,

 

You can create ui page and call GlideModel.

 

 

var confirm = new GlideModal('confirm_p2');
	confirm.setTitle('Confirmation');
	confirm.setPreference("onPromptComplete", "ok");
	confirm.setPreference("onPromptCancel", "cancel");
	confirm.render();

 

 

In ui page you can design like below.

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">
<g:ui_form onsubmit="return invokeConfirmCallBack('ok');">
<table border="0" width="100%">
	<tr><td/>
		
		<p style="font-size: larger;">This task will be closed, and a new one will be created and assigned to the </p>

		<p style="font-size: larger;">IT Service Desk. Would you like to proceed with this? </p>
		
		
	<td/></tr>
        
		<tr>
     	<td nowrap="true"><g:no_escape>${title}</g:no_escape></td>	
	</tr>
        <tr><td/><td/></tr>
        <tr>
            <td  style="padding: 10px;" colspan="2" align="right">
                <g:dialog_buttons_ok_cancel 
                   ok="invokePromptCallBack('ok');" 
                   ok_type="button" 
                   cancel="invokePromptCallBack('cancel')" 
                   cancel_type="button" />
            </td>
        </tr>	
</table>
</g:ui_form>
</j:jelly>

 

Client script

 

function invokePromptCallBack(type) {
    var gdw = GlideDialogWindow.get();
    if (type == 'ok') {
       var f = gdw.getPreference('onPromptComplete');
		gsftSubmit(null, g_form.getFormElement(), 'sysverb_insert');
	}
   
      
    gdw.destroy();
    return false;
}

 

 

RunjayPatel_0-1730538334621.png

 

 

-------------------------------------------------------------------------

If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.


Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay

-------------------------------------------------------------------------

 

 

 

View solution in original post

Hi @Erica2 ,

 

Yes you can do that, make changes in your ui page like below.

<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<g:ui_form onsubmit="return invokeConfirmCallBack('ok');">
<table border="0" width="100%">
	<tr><td/>
		
		<p style="font-size: larger;">This task will be closed, and a new one will be created and assigned to the </p>

		<p style="font-size: larger;">IT Service Desk. Would you like to proceed with this? </p>
		
		
	<td/></tr>
        
		<tr>
     	<td nowrap="true"><g:no_escape>${title}</g:no_escape></td>	
	</tr>
        <tr><td/><td/></tr>
        <tr>
            <td  style="padding: 10px;" colspan="2" align="right">
                <!-- <g:dialog_buttons_ok_cancel 
                   ok="invokePromptCallBack('Yes');" 
                   ok_type="button" 
                   cancel="invokePromptCallBack('cancel')" 
                   cancel_type="button" /> -->
				  
		<div class="modal-footer">
				   
	<span class="pull-right">
		<button class="btn btn-default" id="cancel_button" onclick="invokePromptCallBack('cancel')" style="min-width: 5em;" title="" type="submit">
			No
		</button>
		<button class="btn btn-primary" id="ok_button" onclick="invokePromptCallBack('ok')" style="min-width: 5em;" title="" type="submit">
			Yes
		</button>
	</span>
</div>
            </td>
        </tr>	
</table>
</g:ui_form>
</j:jelly>

 

-------------------------------------------------------------------------

If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.


Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay

-------------------------------------------------------------------------

 

 

View solution in original post

10 REPLIES 10

@Erica2 Another option is to use gm.renderWithContent() instead of gm.render(); method.

var msg = <p>This task will be closed, and a new one will be created and assigned to the<br/>IT Service Desk. Would you like to proceed with this?</p>
gm.renderWithContent(msg);

Runjay Patel
Giga Sage

Hi @Erica2 ,

 

You can create ui page and call GlideModel.

 

 

var confirm = new GlideModal('confirm_p2');
	confirm.setTitle('Confirmation');
	confirm.setPreference("onPromptComplete", "ok");
	confirm.setPreference("onPromptCancel", "cancel");
	confirm.render();

 

 

In ui page you can design like below.

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">
<g:ui_form onsubmit="return invokeConfirmCallBack('ok');">
<table border="0" width="100%">
	<tr><td/>
		
		<p style="font-size: larger;">This task will be closed, and a new one will be created and assigned to the </p>

		<p style="font-size: larger;">IT Service Desk. Would you like to proceed with this? </p>
		
		
	<td/></tr>
        
		<tr>
     	<td nowrap="true"><g:no_escape>${title}</g:no_escape></td>	
	</tr>
        <tr><td/><td/></tr>
        <tr>
            <td  style="padding: 10px;" colspan="2" align="right">
                <g:dialog_buttons_ok_cancel 
                   ok="invokePromptCallBack('ok');" 
                   ok_type="button" 
                   cancel="invokePromptCallBack('cancel')" 
                   cancel_type="button" />
            </td>
        </tr>	
</table>
</g:ui_form>
</j:jelly>

 

Client script

 

function invokePromptCallBack(type) {
    var gdw = GlideDialogWindow.get();
    if (type == 'ok') {
       var f = gdw.getPreference('onPromptComplete');
		gsftSubmit(null, g_form.getFormElement(), 'sysverb_insert');
	}
   
      
    gdw.destroy();
    return false;
}

 

 

RunjayPatel_0-1730538334621.png

 

 

-------------------------------------------------------------------------

If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.


Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay

-------------------------------------------------------------------------

 

 

 

Hi @Runjay Patel 

Thank you for helping. It is working out very well.  Is it possible to change the button name to No and Yes instead of Cancel and OK?  Thanks

Hi @Erica2 ,

 

Yes you can do that, make changes in your ui page like below.

<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<g:ui_form onsubmit="return invokeConfirmCallBack('ok');">
<table border="0" width="100%">
	<tr><td/>
		
		<p style="font-size: larger;">This task will be closed, and a new one will be created and assigned to the </p>

		<p style="font-size: larger;">IT Service Desk. Would you like to proceed with this? </p>
		
		
	<td/></tr>
        
		<tr>
     	<td nowrap="true"><g:no_escape>${title}</g:no_escape></td>	
	</tr>
        <tr><td/><td/></tr>
        <tr>
            <td  style="padding: 10px;" colspan="2" align="right">
                <!-- <g:dialog_buttons_ok_cancel 
                   ok="invokePromptCallBack('Yes');" 
                   ok_type="button" 
                   cancel="invokePromptCallBack('cancel')" 
                   cancel_type="button" /> -->
				  
		<div class="modal-footer">
				   
	<span class="pull-right">
		<button class="btn btn-default" id="cancel_button" onclick="invokePromptCallBack('cancel')" style="min-width: 5em;" title="" type="submit">
			No
		</button>
		<button class="btn btn-primary" id="ok_button" onclick="invokePromptCallBack('ok')" style="min-width: 5em;" title="" type="submit">
			Yes
		</button>
	</span>
</div>
            </td>
        </tr>	
</table>
</g:ui_form>
</j:jelly>

 

-------------------------------------------------------------------------

If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.


Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay

-------------------------------------------------------------------------

 

 

It works perfectly.  Thank you @Runjay Patel