Issue with Business Rule in sc_req_item table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2024 08:41 AM
Hello Everyone,
I have written a business rule in sc_req_item table. Using it, I want to update the value of a field which in sc_cat_item.
u_qty_available_in_warehouse is the field name I want to update. I am attaching the snap of the business rule.
The filter condition is when the state for a requested item changes to "Work In Progress" and this takes place when the request for the item is approved from Flow Designer that I am using for the Service Catalog.
Issue: - Once the business rule trigger it runs for 3 times and rather than subtracting the value once it does it 3 times.
I would appreciate if someone can tell me the possible mistake done by me.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2024 12:58 PM - edited 05-22-2024 12:59 PM
Hi @Shubham_1120131,
The script looks ok, it looks like the Business Rule is triggered multiple times.
This could be from some other processes (e.g. BR) which is updating the record multiple times.
If it's not already, can you update the When field of the BR to after.
Also, I would recommend debugging (e.g. Script Tracer) to identify where the update is coming from.
Cheers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2024 11:21 AM
Hello James,
Thank you for replying to my post. I noticed that once I increased the order for my business rules (since I had some other business rules as well running on the table). Now the business rule gives the desired results.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2024 01:02 PM
No worries, if that is the case, it's likely that there are BRs with small order numbers that are doing current.update().
You may want to get rid of those as it can cause recursions.
Cheers