"Copy Change" should not redirect to new window/tab while creating/copying new change ?

Virendra K
Kilo Sage

Hi All,

 

Requirement is, there is  "Copy Change" UI action button created to copy the change. Functionality is working as expected but the concern is...while copying, change should open in the same tab, not in new tab.

Below are the line of code written. 

How we could open copied /new change in the same tab? please help me.

VirendraK_0-1742213935972.png

VirendraK_1-1742214019105.png

Script:

function OnCopyChangeClick() {
    var srcSysId = g_form.getUniqueValue();
    var ga = new GlideAjax('CustChangeDetails');
    ga.addParam('sysparm_name', 'getChgDetails');
    ga.addParam('sysparm_src_sysid', srcSysId);
    ga.getXMLAnswer(function(answer) {
        var url = "/change_request.do?sys_id=" + answer;
        window.open(url);
       
    });
 
Regards,
Virendra

 

 

1 ACCEPTED SOLUTION

Viraj Hudlikar
Giga Sage

Hello @Virendra K 

 

Give a try with this:

function OnCopyChangeClick() {
    var srcSysId = g_form.getUniqueValue();
    var ga = new GlideAjax('CustChangeDetails');
    ga.addParam('sysparm_name', 'getChgDetails');
    ga.addParam('sysparm_src_sysid', srcSysId);
    ga.getXMLAnswer(function(answer) {
        var url = "/change_request.do?sys_id=" + answer;
        window.location.href = url;
    });
}

If my response has helped you hit helpful button and if your concern is solved do mark my response as correct.

 

Thanks & Regards
Viraj Hudlikar.

View solution in original post

3 REPLIES 3

Viraj Hudlikar
Giga Sage

Hello @Virendra K 

 

Give a try with this:

function OnCopyChangeClick() {
    var srcSysId = g_form.getUniqueValue();
    var ga = new GlideAjax('CustChangeDetails');
    ga.addParam('sysparm_name', 'getChgDetails');
    ga.addParam('sysparm_src_sysid', srcSysId);
    ga.getXMLAnswer(function(answer) {
        var url = "/change_request.do?sys_id=" + answer;
        window.location.href = url;
    });
}

If my response has helped you hit helpful button and if your concern is solved do mark my response as correct.

 

Thanks & Regards
Viraj Hudlikar.

Thank you @Viraj Hudlikar 

Sreeraj
Tera Contributor

Hi Virendra, 

 

Can you try this : window.location.href = url;