- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-09-2022 04:43 PM
i need to write a business rule where, when all the catalog tasks of the catalog item are closed complete then the catalog request item is also closed? Thanks
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-09-2022 05:17 PM
If you are opening all the tasks from workflow, then insert a join activity in front of all catalog task activities. The join activity will wait for all the tasks to be closed. Then insert a set activity to set the state of RITM to closed complete. This should be the preferred approach.
If for some reason you need a BR to close the RITM, use the following code in your after BR
In the condition field of the BR, use
''+current.request_item.cat_item == "060f3afa3731300054b6a3549dbe5d3e" // sys_id of the catalog item so that it only triggers on for a specific catalog item
Please mark my answer as correct/helpful, if it helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-09-2022 06:43 PM
Yes, you can write. I mostly use addEncodedQuery(). It's a personal preference.
Line 19 is querying that catalog task state should be one of pending, open, or in progress. The idea is to find if there is any active task under the RITM.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-09-2022 07:01 PM
i am trying to understand yr logic, in condition you have hard coded the sys_id of the request item?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-09-2022 07:05 PM
Its not the sys_id of request item.
In the condition field - replace the sys_id with the sys_id of the catalog item in your instance. This is to ensure that the BR triggers only for a specific catalog item. I also mentioned the same at line 5.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-09-2022 07:24 PM
thanks a lot
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-09-2022 07:35 PM
You are welcome. But my suggestion would be to handle everything from workflow for catalog items.