Button to open specific view

asd22
Tera Contributor

Hello.

 

I have a button i want to open the view "registrering_av_hardware_ved_innkjøp" with. How do you script buttons in forms take you to a specific view?

 

 

 nyHW();
function nyHW()
{
//make the url to a new normal change
var url = sysparm_view="registrering_av_hardware_ved_innkjøp" ;
//Redirecting the user to the new url
action.setRedirectURL(url);
}

 

find_real_file.png

6 REPLIES 6

Voona Rohila
Tera Patron

Hi asd

Try this:

function nyHW() { //create the new Requested Item Record

    var newReq = new GlideRecord("sc_req_item");

    var id = newReq.insert();

    action.setRedirectURL('/sc_req_item?sys_id=' + id + '&sysparm_view=registrering_av_hardware_ved_innkjøp');
}

Voona Rohila
Tera Patron

Hi asd

can you keep logs and verify 'id' value?