- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
on 07-07-2018 10:51 PM
Hello everyone in the community.
I would like to share a code snippet which I was using to help achieve a use case of mine and thought it would be helpful to share and could help someone achieve a similar use case.
Use Case: Auto Launch a Guided Tour (This is available in Kingston though). But I didn't find an option to restrict the autolaunch based off a condition on the form.
The below is a piece of code which can be used inside a client script.
//If the current state of the form meets your conditions, launch the tour
if(g_form.getValue('some_field') == 'some_value'){
top.NOW.guidedToursService.startTour("sys_id_of_guided_tour_to_be_launched", 0);
//(sys_id of the guided tour you want to launch, step#)
//Check if the guided tour is dismissed by the user, if so then end the tour.
//If not the system will dispaly a message if the user navigates to a different form
//before the completion of the guided tour.
setInterval(function(){
if(top.NOW.guidedToursService.isDismissed){
top.NOW.guidedToursService.endTour();
clearInterval();
}
},2000);
}
The above uses the window.top properties that the instance uses internally to launch the guided tour.
I shall try to update this article if I find any other better solutions if at all not using the window properties.
- 2,430 Views

- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Was just about to give this a shot, thank you for figuring it out and taking the time to share!

- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Thanks for sharing this athm! Are you aware of how to check if a user has completed the tour in the client script? I'd like to do a check and only run the tour if they haven't completed or dismissed it previously.
I found the GuidedTours API documentation here:
https://developer.servicenow.com/dev.do#!/reference/api/orlando/client/guided_toursAPI
It may be that my noob status means I'm not seeing what would be clear to others, but the only option seems to maybe be the event listeners(?). It if is, I'm afraid I'm not clear how I'd use them to achieve what I'm after. I hope you maybe came across the same issue and found a way to not "spam" the user with the guided tour?
Thanks!