How to open a catalog item with pre-populated variables from a portal "Create New" button?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Hello Community,
I have added a "Create New" button on my Service Portal. My goal is that when a user clicks this button, it opens a specific catalog item, and some variables on that item are automatically populated with predefined data.
Could someone please guide me on how to achieve this functionality? Specifically:
- How do I pass variable values when opening the catalog item from the portal?
- Is there a recommended way to implement this using URL parameters or client scripts?
- Any examples or best practices would be much appreciated.
Thank you in advance for your help!
Reference:
HTML :
<button ng-click="c.createNew()">Create New</button>
Server Script:
(function() {
// Pass the URL to client script
data.redirectUrl = "/sp?id=sc_cat_item&sys_id=67e2f2da4fff0200086eeed18110c7dd";
})();
Client Script:
Client Script:
api.controller = function() {
var c = this;
// The URL sent from server
c.url = c.data.redirectUrl;
// Function to open URL in new tab
c.createNew = function() {
window.open(c.url, '_blank'); // Opens URL in a new browser tab
};
};
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 hours ago
You can create "onLoad" catalog client script on the catalog item to pass the variables.
