Call a Business Rule in a new Fix Script

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-11-2023 05:08 AM
Hi,
I need to create a new Fix script to call a business rule available in Incident table.
How to do this?
I've a business rule 'Copy State to Incident State'. It was deactivated for some modification. Now I've activated it and it is getting triggered when new Incident is being created. But I've a lot of INCs there in incident table. I need to create a Fix script and call this business rule, so that all the INCs will get affected.
How to do this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-11-2023 06:04 AM
Typically you would not call the business rule. You would mimic the code in the business rule in your script to update those that are out of synch. Also, fix scripts are intended for use with install of scoped applications now. If running a one time script to fix items outside that scenario, it is best practice to create a scheduled job (scheduled script action) that is set to on demand.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-11-2023 07:50 AM
Hi @Kristen Ankeny can you please let me know, how I can call the BR in my scheduled job?
Please note that, there is no script in the BR, there is one Action Item in the BR.
I need to call this BR for all the Incident Records.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-11-2023 01:36 PM
You will need to query the incident records, then check if the two fields match, if not then set incident state to the state and update.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-11-2023 08:58 AM
Hi,
Check conditions in Business Rule when it is triggering. Build the query in the fix script based on those conditions (or) change the business rule conditions to trigger for all records.
If your business rule functionality is simple, you can try to write that logic in your fix script.
Don't use set workflow(false) in your fix script to trigger business rules while running this fix script.
Please mark it as helpful (or) correct if it helps.
Thanks & Regards,
Sumanth Meda.