Get a first look at what's coming. The Developer Passport Australia Release Preview kicks off March 12. Dive in! 

how to get Present record sys_id OnCelledit .

sam36
Tera Contributor

I am trying to redirect URL whenever user select reject option in list view  then it should redirect to approval record the below script is working for Related List not  for List view nothing is happening . please help in resolving this issue.

@Ankur Bawiskar 

function onCellEdit(sysIDs, table, oldValues, newValue, callback) {

var saveAndClose = true;
if(newValue=='rejected' ){
alert('ga is '+g_form.getUniqueValue());
// hosturl + "/sysapproval_approver.do?sys_id="+g_form.getUniqueValue();
var redirectURL = '/sysapproval_approver.do?sys_id='+g_form.getUniqueValue();
top.window.location=redirectURL;
saveAndClose = false;
}
else
{

saveAndClose = true;

}
callback(saveAndClose);
}

 

find_real_file.png

 

 

 

 

 

find_real_file.png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron

Hi,

g_form won't work in oncell edit

use this for getting sys_id of the row being edited -> sysIDs

function onCellEdit(sysIDs, table, oldValues, newValue, callback) {

    var saveAndClose = true;
    if(newValue == 'rejected' ){
        alert('ga is '+ sysIDs);
        var redirectURL = '/sysapproval_approver.do?sys_id=' + sysIDs;
        top.window.location=redirectURL;
        saveAndClose = false;
    }
    else
    {

        saveAndClose = true;

    }
    callback(saveAndClose);
}

Regards
Ankur

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

View solution in original post

3 REPLIES 3

sam36
Tera Contributor

 

@Pradeep Sharma
 

Ankur Bawiskar
Tera Patron

Hi,

g_form won't work in oncell edit

use this for getting sys_id of the row being edited -> sysIDs

function onCellEdit(sysIDs, table, oldValues, newValue, callback) {

    var saveAndClose = true;
    if(newValue == 'rejected' ){
        alert('ga is '+ sysIDs);
        var redirectURL = '/sysapproval_approver.do?sys_id=' + sysIDs;
        top.window.location=redirectURL;
        saveAndClose = false;
    }
    else
    {

        saveAndClose = true;

    }
    callback(saveAndClose);
}

Regards
Ankur

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

Thanksalot  @Ankur Bawiskar  you are Genius Expert.