Scripting Help- How to open a Catalog Item in a New Window
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-15-2024 10:28 AM
I have a UI Action that redirects to a Catalog Item and passes a variable (with the help of a Catalog Client Script)
This works fine.
How can I get this UI Action to open the Catalog Item in a New Window?
Currently, it opens the Catalog Item in the same window, which is not wanted because the end user wants to still have that same original record open, in the original window.
Here is my UI Action code:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-15-2024 11:56 AM
Hello,
To get your **UI Action** to open the **Catalog Item** in a new window, you can modify your UI Action script by using JavaScript's `window.open()` method, which opens the URL in a new tab or window, depending on the user's browser settings.
Here’s how you can update your UI Action code:
Updated UI Action Script:
javascript
function openInNewWindow() {
var url = 'com.glideapp.servicecatalog_cat_item_view.do?sysparm_id=ea3841fc4751351010057cb2a36d438b&sysparm_short_desc=' + short_desc;
window.open(url, '_blank'); // Opens in a new tab/window
}
openInNewWindow();
```
This will ensure the **Catalog Item** opens in a new window, while the original record remains open in the current window.
If this solution helps, I would appreciate it if you could mark it as helpful!
Best regards,
Raja
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-15-2024 01:31 PM
@sadif_raja This did not work.
I have tried:
And I have tried:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-15-2024 12:17 PM
Instead of setRedirect, try using the following in your UI Action:
var url = 'com.glideapp.servicecatalog_cat_item_view.do?sysparm_id=ea3841fc4751351010057cb2a36d438b&sysparm_short_desc=' + short_desc)';
window.open(url,'_blank');
You might need to give it the whole URL though. Give it a try and see if this works.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-15-2024 01:37 PM