- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-08-2024 01:57 PM
Hello,
Requirement - When any incident get creates with particular value in it, create a request, request item and sc Task.
How do I create a business rule on Incident table which creates a request by filling out variables through script and request item. Can you please provide a correct sample script?
Thanks in advanced.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-08-2024 02:34 PM - edited 10-08-2024 02:38 PM
Hi @Dk nov
Yes you can raise catalog item from script.
Below is the sample code:
var cartId = GlideGuid.generate(null);
var cart = new Cart(cartId);
var item= cart.addItem('give_item_sysid'); //pass catalog item sys_id here
cart.setVariable(item,'variable_name1','value123'); //pass variable name and values
cart.setVariable(item,'variable_name1','value123');
var req_id = cart.placeOrder();
Use above code in your BR accordingly and pass values dynamically.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-08-2024 02:34 PM - edited 10-08-2024 02:38 PM
Hi @Dk nov
Yes you can raise catalog item from script.
Below is the sample code:
var cartId = GlideGuid.generate(null);
var cart = new Cart(cartId);
var item= cart.addItem('give_item_sysid'); //pass catalog item sys_id here
cart.setVariable(item,'variable_name1','value123'); //pass variable name and values
cart.setVariable(item,'variable_name1','value123');
var req_id = cart.placeOrder();
Use above code in your BR accordingly and pass values dynamically.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-15-2024 11:00 AM
@Voona Rohila - Thank you! It worked!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-08-2024 09:38 PM
Hi @Dk nov
You can use CartAPI. Refer below links and give it a try -
https://www.servicenow.com/community/developer-forum/create-request-from-business-rule/m-p/1513026
Thanks and Regards
Amit Verma
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-16-2025 11:36 PM
thanks