Background script doesn´t trigger business rules
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2024 04:32 AM
Hello people.
I am quite new on SN, only a year but previously when I change some data from Background scripts, it always run all the business rules with the match condition. But this time I see a new message that shows me the opposite.
Some insight about why is this happening? Thanks for your help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2024 04:37 AM
Hi,
You are not using setWorkflow(false) which makes sure that BRs don't run for the transaction.
Only other thing I can think is , there is nothing getting updated, if there are no fields that get updated, the update is skipped and hence there will not be aby workflows running.
So try to add the below in your GlideRecord, this forces an update to the record even if no fields are changed.
gr.setForceUpdate(true); //Force the update
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2024 04:55 AM
Hi @MarcosBR,
I can see that you're performing a GlideRecord query on what looks like a scoped application. Can you confirm this? Please make sure when running the Background script you have the correct scope selected at the bottom of the Background script form.
If the scope is not available, you have the option of creating a Fix script in required application scope & then use it.
Best practice tip: I can see you are using the variable 'gr' for your GlideRecord call up. This is not good practice. It's best to call the variable something unique and something other than gr.
To help others (or for me to help you more directly), please mark this response correct by clicking on Accept as Solution and/or Kudos.
Thanks, Robbie

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2024 04:58 AM
@MarcosBR It looks like your script is causing a recursion due to which the business rule is not called. Please verify your script and check which portions are causing a recursions.