- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2024 11:05 AM
Hello,
I have the following requirement:
I have a catalog item, on the catalog item if the following box is NOT true:
Once the form is submitted, on TASK I have a Quantity field, so if the above box is NOT true, I would like the Quantity field on the TASK to default to 1.
How can I achieve that?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2024 11:44 AM
If you are referring to a Catalog Task, where quantity is a field as opposed to a Catalog Item variable, on the sc_task table you can create a before Insert Business Rule so that when the Catalog Task is created it will set the quantity field to 1 if the Catalog Item variable box is unchecked. If this box could be checked after the initial request / after a Catalog Task has been created, then also check the Update box on the When to run tab of the Business Rule, and ensure that the Catalog Item variable has been included in the Catalog Task.
(function executeRule(current, previous /*null when async*/) {
if(current.request_item.variables.variable_name == 'false') {
current.quantity = 1;
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2024 11:44 AM
If you are referring to a Catalog Task, where quantity is a field as opposed to a Catalog Item variable, on the sc_task table you can create a before Insert Business Rule so that when the Catalog Task is created it will set the quantity field to 1 if the Catalog Item variable box is unchecked. If this box could be checked after the initial request / after a Catalog Task has been created, then also check the Update box on the When to run tab of the Business Rule, and ensure that the Catalog Item variable has been included in the Catalog Task.
(function executeRule(current, previous /*null when async*/) {
if(current.request_item.variables.variable_name == 'false') {
current.quantity = 1;
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2024 11:48 AM
If it is on CTASK Level, Then I would go with same approach brad suggested and add additional conditions to make sure the BR triggers only for that particular catalog item
Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2024 12:38 PM
thank you. this worked!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2024 11:45 AM
Hi @Jen11
You want to update the quantity on RITM record after the request is submitted?
Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP