How to Open a incident in the main tab by using a ui action

NeethuB
Tera Contributor

i have created UI Action "Save & Next" which will open the next incident assigned to me. it is opening but in the sub tab of the 1st opened ticket . i want to open it in the parent tab itself. how can i do that.

8 REPLIES 8

GlideFather
Tera Patron

Ahoy @NeethuB,

 

you did something but we don't see what ;)) could you possibly share the UI action as well as explain what sur or parent tab do you mean - is it a workspace, or native Ui or browser... what tabs are you talking about?

_____
Answers generated by GlideFather. Check for accuracy.

Hi @GlideFather ,
UI Action:

function onClick(g_form) {
    var number = g_form.getValue('number');

    g_form.save().then(function() {

        var ga = new GlideAjax('GetNextIncident');
        ga.addParam('sysparm_name', 'getNext');
        ga.addParam('sysparm_number', number);

        ga.getXMLAnswer(function(answer) {

            if (answer) {
                 //Replace current tab (NO close needed)
                g_aw.openRecord('incident', answer, {
                    target: 'current'
                });
                //g_aw.openUrl('/now/sow/record/incident/' + answer);
            } else {
                g_form.addInfoMessage("No more incidents.");
            }
        });
    });
}


Script Include:

var GetNextIncident = Class.create();
GetNextIncident.prototype = Object.extendsObject(AbstractAjaxProcessor, {

    getNext: function() {
        var currentNumber = this.getParameter('sysparm_number');

        var gr = new GlideRecord('incident');
        gr.addQuery('assigned_to', gs.getUserID());
        gr.addQuery('active', true);
        gr.addQuery('number', '>', currentNumber);
        gr.orderBy('number');
        gr.query();

        if (gr.next()) {
            gs.info("eerroo next:"+gr.number);
            return gr.sys_id.toString();
        } else {
            // Wrap to smallest
            var gr2 = new GlideRecord('incident');
            gr2.addQuery('assigned_to', gs.getUserID());
            gr2.addQuery('active', true);
            gr2.orderBy('number');
            gr2.query();

            if (gr2.next()) {
                gs.info("eerroo next2:"+gr.number);
                return gr2.sys_id.toString();
            }
        }
        gs.info("eerroo next3:");
        return '';
    }

});

in the SOW next incident is opening in a child tab.I want to open it as a main tab (Parent tab)

Ankur Bawiskar
Tera Patron

@NeethuB 

but why this customization?

Why not train your agents to use SOW and click on Assigned to me in list?

I think your requirement is not feasible

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

Hi @Ankur Bawiskar ,
It's a requirement we received. I have did most things but it is opening in child tab that's it.