Business Rule won't fire
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-16-2024 11:28 AM
Afternoon all-
Haven't posted in a minute, but was working on creating a business rule to fire when a field in the incident form (Assignment Group) is populated by another rule when an insert is executed. I created a BR, and am calling a Script include (just code to post some data to an API)..
Here is the BR:
Here is the script include:
Not seeing anything in the logs, so I'm kinda puzzl. d. Any suggestions?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-16-2024 12:06 PM
Hi @Mike 3_0 ,
So on new incident creation, when short description matched, then BR is triggering myfunction() method, which in turn calling a REST API.
We don't see any gs.log(); Add some more gs.log() in BR and Script Include and check the execution flow path.
Thanks,
AshishKM
Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-16-2024 06:45 PM
Hello Ashish:
I had some log statements put in and I noticed this:
So it would appear that the BR is firing and invoking the Script include, but its not pulling the data from the incident per these lines in my code:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-17-2024 08:07 PM
Hi @Mike 3_0,
You need to pass the 'current' GlideRecord object in your BR.
Something like:
In the Business Rule:
x.myFunction(current);
In the Script Include:
myFunction: function(current){
}
And is the 'x_pd_integration_incident' a field on your Incident table?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2024 05:07 AM
Good morning-
Per the holiday weekend, I'm back on this item.. I did note I was able to get the BR to fire properly and injected the code (with log statements) to it as an initial test and noted that there were fields that weren't being assigned a value. I'll go back and look at your suggestion also. I noted that when I did test the code in the BR itself, everything executed up to the point of making the API call (put) and was going to add more logging statements to see where the item was.
More to follow-
Mike E-