
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2020 07:59 AM
I've a requirement where,
On incident form, if the logged in user is part of Application support group, user should be able to view the Button “Resolve child tickets”. On click of this button, user should receive a confirmation message. “There are X child incidents associated with this ticket” Do you want to resolve these child tickets ?.
If user selects Yes, then the associated child tickets should be resolved with the resolution codes of parent incident.
If user selects No, then no action is needed.
However I was trying to implement. But it is not working. Find my below code in UI Action page:
function resolveChildIncident()
{
//var count = g_form.get('child_incidents');
var answer=confirm("There are X child incidents associated with this ticket. Do you want to resolve these child tickets?");
if (answer == true)
{
gsftSubmit(null,g_form.getFormElement(),'sys_resolvechildincident');
}
}
var gr=new GlideRecord('incident');
gr.addQuery('parent_incident',current.sys_id);
gr.query();
while(gr.next())
{
gr.state='6';
gr.update();
}
action.setRedirectURL(current);
//
In this UI Action page below are the field name-
UI Action Name: Resolve Child Incident
Action Name: sys_resolvechildincident
Onclick: resolveChildIncident();
Let me know if anyone can help me out on this.
Solved! Go to Solution.
- Labels:
-
Incident Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2020 08:28 AM
HI,
Try below script:
function resolveChildIncident()
{
//var count = g_form.get('child_incidents');
var answer=confirm("There are X child incidents associated with this ticket. Do you want to resolve these child tickets?");
if (answer == true)
{
gsftSubmit(null,g_form.getFormElement(),'sys_resolvechildincident');
}
if (typeof window == 'undefined')
serveResolve();
function serveResolve(){
var gr=new GlideRecord('incident');
gr.addQuery('parent_incident',current.sys_id);
gr.query();
while(gr.next())
{
gr.state='6';
gr.update();
}
action.setRedirectURL(current);
}
Thanks,
Ashutosh Munot

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2020 08:28 AM
Hi,
If you want to hide/show this Ui Action based on Condition then try below script
gs.getUser().isMemberOf('Application support')
In Your code add this
if(typeof window == 'undefined')
runBusRuleCode();
I have edited your code.
Try below code
function resolveChildIncident()
{
//var count = g_form.get('child_incidents');
var answer=confirm("There are X child incidents associated with this ticket. Do you want to resolve these child tickets?");
if (answer == true)
{
gsftSubmit(null,g_form.getFormElement(),'sys_resolvechildincident');
}
}
if(typeof window == 'undefined')
runBusRuleCode();
function runBusRuleCode()
{
//Server-side function
var gr=new GlideRecord('incident');
gr.addQuery('parent_incident',current.sys_id);
gr.query();
while(gr.next())
{
gr.state='6';
gr.update();
}
action.setRedirectURL(current);
}
Please Mark Correct/Helpful answer if it help you in any way.
Thanks,
Kunal

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2020 08:28 AM
HI,
Try below script:
function resolveChildIncident()
{
//var count = g_form.get('child_incidents');
var answer=confirm("There are X child incidents associated with this ticket. Do you want to resolve these child tickets?");
if (answer == true)
{
gsftSubmit(null,g_form.getFormElement(),'sys_resolvechildincident');
}
if (typeof window == 'undefined')
serveResolve();
function serveResolve(){
var gr=new GlideRecord('incident');
gr.addQuery('parent_incident',current.sys_id);
gr.query();
while(gr.next())
{
gr.state='6';
gr.update();
}
action.setRedirectURL(current);
}
Thanks,
Ashutosh Munot
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2020 09:06 AM
Thank you Ashutosh. Yes, it worked. May I know how it worked by introducing
if (typeof window == 'undefined')
serveResolve();

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2020 10:57 AM