Triggering using Cart API
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-18-2023 11:05 PM
I want to trigger a catalog item using another catalog item and getting input variable from one catalog item to the other, using Cart catalog API by using a custom flow designer action.
If any other ways to do this, please do tell me.
I am relatively new to SN platform. So please do explain in a way fresher can understand.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-19-2023 02:58 AM
Hi @HussainM ,
- Create a custom flow designer action that triggers the second catalog item.
- In the custom flow designer action, use the Cart API to add the first catalog item to the cart.
- In the custom flow designer action, retrieve the input variable from the first catalog item and pass it as a parameter to the second catalog item.
- Add the custom flow designer action to the first catalog item's flow.
Example of code snippet:
// Add first catalog item to the cart
var cartAPI = new Cart();
var cartItem = cartAPI.addItem('cat_item_sys_id_1');
// Retrieve input variable from the first catalog item
var inputVariable = cartItem.getVariable('input_variable_name');
// Add input variable as a parameter to the second catalog item
cartAPI.addItem('cat_item_sys_id_2', inputVariable);
// Submit the cart
cartAPI.submit();
Please note that you need to replace the 'cat_item_sys_id_1' and 'cat_item_sys_id_2' with the actual sys_id of the catalog items, and 'input_variable_name' with the name of the input variable you want to pass to the second catalog item. Also make sure that you have the right permissions to access the catalog item and cart API.
Please mark the suggestion as helpful, if you find it useful to you or others who wants to refer similar content.
Please mark the solution as correct, if the answer provided by me has resolved your query.
Thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-19-2023 03:08 AM
in flow designer there is an action for this OOB and you need not use any script
Submit Catalog Item Request action
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