Button to open specific view
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-15-2022 05:06 AM
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);
}
- Labels:
-
Service Portal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-15-2022 05:18 AM
Hi
The redirect needs to include the view.
function createRITM() { //create the new Requested Item Record
var newReq = new GlideRecord("sc_req_item");
// set your fields here
var id = newReq.insert();
action.setRedirectURL('sc_req_item?sys_id=' + id + '&sysparm_view=YOURVIEWNAME');}
Other sample : action.setRedirectURL('sc_req_item.do?sys_id=' + newReq.insert + '&sysparm_view=Equip_Request');
To redirect to a specific view, that's where you'll have to build the URL including the sysparm_view= part I described above.
Mark my answer correct & Helpful, if Applicable.
Thanks,
Sandeep
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-15-2022 05:25 AM
Hello and thanks for the quick respons
Im having issues with 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');}
as it wont open the veiw i have set. any ideas why?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-15-2022 05:44 AM
You will have to debug this : action.setRedirectURL('sc_req_item?sys_id=' + id + '&sysparm_view=registrering_av_hardware_ved_innkjøp');

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-15-2022 07:06 AM
I think it will be easier if you share the whole screenshot of your ui action config instead of partial and also the result SS of the same