- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2016 04:57 PM
Hi,
Here is what I need:
When a user resolves/closes a Problem from the form, if there are any related Incidents then the states of these incidents need to be automatically set to resolved. This is quite easy to do using a UI Action and some scripting. There is one caveat though, I need the user to select 3 fields that will be set in all these related Incidents prior to closing the problem (e.g. Incident Close Code, Incident Resolved By, Incident Close Date).
Here is the issue I'm running into:
I figured I could do this using GlideDialog pop up box and retreive the necessary fields, then update all the incidents with these values. But when a user clicks the button "Close Problem" and my popup shows, there's no way to retrieve the values from the popup box and send them along with the server side script that gets called from the UI Action after it's complete. I can update all the incidents from the UI Page "Processing Script" too, but then I lose the Problem form submission.... I feel like I'm caught in a catch 22 situation. Does anyone know of a way around this?
Thanks,
-Tyson
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2016 09:53 PM
Hi Tyson,
I mimicked the scenarios and I got what you are struggling with.
I can think of two ways to solve this
1) Capture the information you require to update the "Problem" record via dialogue box only with additional input fields configured on dialogue box . Whatever the information entered, you pass it on to script include and update the problem record. At the same time, you will have the information required to update related "Incidents" via dialogue box and process it in script include.
2) Have the UI Action button update the "Problem" record only via normal way, user will enter details onto the actual problem form, will click on the UI Action button which will update the problem. Once done, redirect user to same problem record. Now you will have "Problem" state changed to "Resolved" so configure UI Policy which will trigger when condition is resolved. Call the Dialogue box via this UI Policy and update the related incidents. You will have to configure some checkbox on Problem table which will check whether to call the Dialogue box. Else, Dialogue box will be called everytime form is opened and state is resolved.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2016 05:01 PM
Also, here is a some code:
if (isRelatedOpenIncident()){
openIncidentDialog(); //calls GlideDialog
//gsftSubmit(null, g_form.getFormElement(), "close.problem");
}else{
gsftSubmit(null, g_form.getFormElement(), "close.problem");
}
I can't open the dialog which updates all the related incidents, and at the same time save the problem form (which will close the problem)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2016 07:37 PM
Hi Tyson,
GlideDialogWindow API Reference - ServiceNow Wiki
Displaying a Custom Dialog - ServiceNow Wiki
Kindly check these two wiki articles to display GlideDialog window via UI Action.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2016 07:54 PM
Hi Deepak,
Thank you for the references, but I have already been able to successfully accomplish showing a Pop Up window from a UI Action. My issue is that the UI Action needs to take information from the Custom Dialog (Client side), then save this information from the Server side portion of the original UI Action (Problem).
I would need the problem UI Action to pause, then wait for the user to input information on the dialog pop up, then complete the UI Action with supplied information. I wonder if this is even possible or if there is another way to accomplish this... What's even more frustrating is I'm able to update the Incidents from the Dialog UI Page itself, but I'm not able to sync the update of the problem form then.
In other words, I just need to close all related Incidents that are attached to the Problem when a user closes a problem. But I need the have a user set Close Codes for all the related incidents before they close...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2016 08:06 PM
Hi Tyson,
Correct me If my understanding is wrong
1) You require to resolve all the related incidents to Problem record when user clicks on Resolve OR Close problem UI Action
2) This UI Action calls the Dialog UI Page, where user enters "Three " mandatory field info required for Incident record closure.
3) You are not able to find a way to capture information entered by user in this dialog window to carry on to Incidents
I guess this can be done by
1) Client script portion available on your UI Page
2) you will have to capture the "three" field contents from dialog box via DOM method, like gel('elementID') etc.
3) Once done, you will also have to capture the "problem" sys_id
4) Initiate the AJAX call from UI page client script to Script Include which will accept "three" field details + Problem sys_id
5) Client callable script include will then process the closure of related problem with the help of above parameters.
Kindly let me know if you require additional help