- 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
11-01-2024 11:52 PM
@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);
- 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 11:17 AM
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
- 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
11-10-2024 06:15 PM
It works perfectly. Thank you @Runjay Patel