How to create a user input pop up window?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2017 05:07 PM
Hi All,
I have a requirement when a HRcase reopened, user have to enter reason for reopening the case. When user click on "Reopen case" UI action it should pop up a window for user to enter reason for reopening (should have an "ok" or "cancel" button in that window) and when user click ok it should check if the input box is empty and add that comment into Comment field , change the case state to work in progress and save. if user click cancel then it should return to current page. Comment shouldn't be empty.
- Labels:
-
Service Catalog

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-26-2017 03:02 AM
Hie Sarasaamani,
Refer this for setting size of window box.
GlideDialogWindow API Reference - ServiceNow Wiki
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2017 07:34 PM
Hi Nayan,
its working but i have another problem now.Hope someone can help.
when i reopen a hr case , add comment and save , it's changing the state from Resolved to "work in progress" and saving the comment from pop up box. But when i impersonate a end user and tried to reopen a case, its just updating the comment but not changing the state to work in progress. Is it due to my admin access?
in the client script :-
function validateComments() {
//This script is called when the user clicks "OK" in the dialog window
//Make sure there are comments to submit
var comments = gel("dialog_comments").value;
comments = trim(comments);
if (comments == "") {
//If comments are empty, alert the user and stop submission
alert("Please enter your comments before submitting.");
return false;
}
//If there are comments, close the dialog window and submit them
GlideDialogWindow.get().destroy(); //Close the dialog window
g_form.setValue("description", comments); //Set the "description" field with comments in the dialog
g_form.setValue("state", '18');
g_form.save();
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2017 10:14 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2017 10:44 PM
Hi Nayan,
You're right, ACL is the one controlling the state. However, initially they were able to change the state with the UI action script below. Is there any way for me to add this into Validatecomment() client script? cause when i add this into script, its not saving the comment or changing state. can't use UI action script in client script?
new StateFlow().processFlow(current, 'c77bfec04f682200143327201310c7d7', 'manual');
current.state = '18';
current.update();
action.setRedirectURL(current);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2017 10:56 PM
Hey,
You can update state field after the function on UI Action like this -
function validateComments() {
//This script is called when the user clicks "OK" in the dialog window
//Make sure there are comments to submit
var comments = gel("dialog_comments").value;
comments = trim(comments);
if (comments == "") {
//If comments are empty, alert the user and stop submission
alert("Please enter your comments before submitting.");
return false;
}
//If there are comments, close the dialog window and submit them
GlideDialogWindow.get().destroy(); //Close the dialog window
g_form.setValue("description", comments); //Set the "description" field with comments in the dialog
g_form.save();
}
//Setting State as "Work in Progress"
if(current.additional_comments.changes())
current.state = '18';
current.update();