- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-30-2024 02:54 PM
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.
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() {
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2024 02:04 AM - edited 11-02-2024 02:05 AM
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;
}
-------------------------------------------------------------------------
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
-------------------------------------------------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-07-2024 08:19 PM
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
-------------------------------------------------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-30-2024 03:30 PM
Hello @Erica2
As far as I know this is something we cannot acheive this because title accepts only string where it doesn't support multiline text formatting so you'll need to work within those constraints. Unfortunately, if the title doesn't allow for line breaks or HTML, your options will be limited.
Murthy

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-31-2024 01:34 AM
@Erica2 How about changing a title string a little bit.
var gm = new GlideModal('glide_confirm_standard', true);
gm.setTitle("Task Closure and New Assignment");
gm.setPreference("title", 'Clicking on the OK button will close this task and create a new task assigned to the IT Service Desk. Would you like to proceed with this?');
gm.setPreference("warning", "false");
gm.setPreference('onPromptComplete', complete);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-31-2024 09:15 AM
Thank you for your suggestion @Hitoshi Ozawa
That was a clever idea, and it works perfectly for this situation. However, if there is a way to insert a new line using code, I would like to learn it, as there may be times when we will need to use it.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-31-2024 03:00 PM
@Erica2 Unfortunately no with glide_confirm_standard. ServiceNow is escaping and concatenating the string and putting it in double quotes.
Would have to clone and edit the UI page. Won't recommend it too much because it may stop working after versioning up ServiceNow.