when a perticular ui action is clicked then how to pop up a text box
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-26-2024 12:28 AM - edited ‎03-26-2024 12:30 AM
when a perticular ui action is clicked then how to pop up a text box
3 REPLIES 3
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-26-2024 10:04 AM
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-26-2024 10:10 AM
Hi,
You can use something simple in JavaScript like this
var person = prompt("Question:", "Sample Text");
-Anurag
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-26-2024 11:03 AM
Hi @anupambose
I have created something similar for my use case. When case is canceled, it asks for a reason in a dialogue box. You can do similarly-
function confirmCancellation() {
var gm = new GlideModal('convertToLabel');
gm.setTitle('Reason For Cancelation');
gm.renderWithContent('<div style="padding:15px"><p>Please write the reason for canceling this case.</p><p><textarea id="taskCancellation" name= "cancellation" rows="2" cols="60"></textarea></p><div style="padding:5px;float:right"><button style="padding:5px;margin-right:10px" onclick="window.changeTaskAction(this.innerHTML,jQuery(\'#taskCancellation\').val())" class="btn btn-success">Don\'t Cancel</button><button style="padding:5px" class="btn btn-danger" onclick="window.changeTaskAction(this.innerHTML,jQuery(\'#taskCancellation\').val())">Cancel Case</button></div></div>');
window.changeTaskAction = function(thisButton, thisAction) {
gm.destroy();
if (thisButton == 'Cancel Case') {
var userInput = thisAction;
if (thisAction) {
g_form.setValue('state', '7');
g_form.setValue('close_notes', thisAction);
g_form.setValue('active', 'false');
var fields = g_form.getEditableFields();
for (var x = 0; x < fields.length; x++) {
g_form.setMandatory(fields[x], false);
}
}
gsftSubmit(null, g_form.getFormElement(), 'cancelCase');
}
};
return false; //prevents the form from submitting when the dialog first loads
}
if (typeof window == 'undefined') {
cancelThisCase();
}
function cancelThisCase() {
current.state = '7';
//current.active = 'false';
current.closed_at = new GlideDateTime();
current.setWorkflow(false);
current.work_notes = 'Case cancelled by ' + gs.getUserName();
current.update();
action.setRedirectURL(current);