Is it possible to create a script depending on the module accessed?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-01-2024 06:03 PM
Hello experts,
Do you know of any method that can trigger a script based on the module that is accessed?
For example, the client script will only run if this module is clicked:
We cannot use the view parameter since we are just using the same views. Except there is different module with different URL argument. Is it possible to add a tag in URL argument for when that module is clicked?
Regards,
Vaine
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-01-2024 11:05 PM
ensure your client script runs on all views
simply in the client script check the URL and see the module sysId and then add your logic
check this parameter in the URL -> sysparm_userpref_module=
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-04-2024 04:21 PM
Hello,
How do you get that URL value in the client script?
For getting view, there is a method g_form.getParameter('view') to get the view, is there also a method for getting the module?
Regards,
Vaine