Next Experience UI Terms & Condition Popup on Load

patbishop
Mega Guru

We have a need to display a Terms and Conditions popup, when initially logging into the Instance. Previously, this was accomplished in UI16 via UI script. I've modified the script and can get the popup to appear in the Next Experience UI EXCEPT for when the user clicks the "Cancel" button when the home page is loading in the main window. If this happens, the user can then click on any side navigation and bypass the popup.  

 

I found the following Documentation: https://docs.servicenow.com/bundle/tokyo-platform-user-interface/page/administer/navigation-and-ui/t...

 

When attempting this, I am not seeing any popup or welcome message. Has anyone used the Login Features yet, or found a workaround.

 

NOTE: Below is the code I attempted to also modify to make the UI Script work for Next Experience UI, but will not trigger if the "Cancel" button is click quickly when the homepage is loading. 

 

 

try{
	var topUrl = getTopWindow().location.toString();

	// URL fragments to test to determine whether we should display the Terms & Condiions confirmation
	//nav_to.do is for UI 16, now/nav/ui/classic/... is for Next Experience UI
	var urlTestFragments = [
		'nav_to.do?uri=%2Fhome_splash.do%3Fsysparm_direct%3Dtrue',
		'now/nav/ui/classic/params/target/home.do',
		'now/nav/ui/classic/params/target/%24pa_dashboard.do',
		'now/nav/ui/classic/params/target/home_splash.do%3Fsysparm_direct%3Dtrue',
		'now/nav/ui/classic/params/target/cancel_my_transaction.do%3Fsysparm_page%3Dhome',
		'now/nav/ui/classic/params/target/transaction_canceled.do%3Fsysparm_direct%3Dtrue',
		'navpage.do'
	];

	if(typeof topUrl == 'string' && topUrl.length > 0) {
		var matchFound = false;

		//loop through the TestFragments to see if top URL is one of them.
		for(var i = 0; i < urlTestFragments.length; i++) {
			if(topUrl.indexOf(urlTestFragments[i]) >= 0) {
				matchFound = true;
				break;
			}
		}
		//If a Match is Found, then display the TOC
		if(matchFound) {
			var termsAndConditions = 'Terms and Condition:' +'\n'+'You are accessing a U.S. Government information system, which includes (i) this information system; (ii) this information systems network; (iii) all information systems connected to this network; and (iv) all devices and storage media attached to this network or to information systems on this network.This information system is provided for U. S. Government-authorized use only.Unauthorized or improper use of this system may result in disciplinary action, as well as civil and criminal penalties.By using this information system, you understand and consent to the following;'+ '\n' + 'You have no reasonable expectation of privacy regarding any communications or data transiting or stored on this information system.  At any time, and for any lawful government purpose, the government may monitor, intercept, and search and seize any communication or data transiting or stored on this information system. Any communications or data transiting or stored on this information system may be disclosed or used for any lawful government purpose. Nothing herein consents to the search or seizure of a privately-owned information system or other privately owned communications devices, or the contents thereof that is in the system users home.';
			var con=confirm(termsAndConditions);

			//If Match is NOT found, log out user
			if(!con) {
				top.window.location = 'logout.do';
			}
		}
	}
} catch(e) {
	console.warn(e);
}

 

 

1 REPLY 1

ikusghiuweghaku
Tera Contributor

Hi PatBishop

 

Are you able to get the Popup after login in the Next experience

 

Regards

Cheran