Business Rule won't fire

Mike 3_0
Tera Contributor

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:

 

Screenshot 2024-02-16 at 2.27.01 PM.png

 

 

Screenshot 2024-02-16 at 2.23.46 PM.png

 

Here is the script include:

 

Screenshot 2024-02-16 at 2.26.06 PM.png

Not seeing anything in the logs, so I'm kinda puzzl. d. Any suggestions?

4 REPLIES 4

AshishKM
Kilo Patron
Kilo Patron

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

Mike 3_0
Tera Contributor

Hello Ashish:

 

I had some log statements put in and I noticed this:

 

Screenshot 2024-02-16 at 9.40.17 PM.png

 

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:

 

var confUpdateEndpoint = ("https://api.pagerduty.com/incidents/" + current.x_pd_integration_incident);
gs.info("Here is the proper URL: " + confUpdateEndpoint);
 
Going to look at why the data from the incident is not being pulled in..
 
Thanx.
 
Mike E-

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

 

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-