- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2023 05:33 AM
Hello,
When I select the checkbox variable of a record producer in the service portal, it needs to be an open link in a separate tab.
note: Can we achieve this without DOM?
Thanks in advance
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2023 06:07 AM
use this onChange catalog client script on that variable
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading) {
return;
}
var url = '/sp?id=sc_cat_item&sys_id=recordProducerSysId'; // give here your portal name and the record producer sysId
if (newValue == "your value to compare") {
try{
if(window != null)
g_navigation.open(url, '_blank');
}
catch(ex){
top.window.open(url,"_blank");
}
}
}
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
11-06-2023 06:36 AM
The code Ankur gave has no dom manipulation, its good.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2023 06:37 AM
yes, the script I shared will run on both native+portal, UI Type - ALL. Ensure Isolate Script is false for your client script
where are you planning this to run? native or portal
If only native then use this line
g_navigation.open(url, '_blank');
If only portal then use this line
top.window.open(url,"_blank");
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