- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-06-2022 07:51 AM
I have an inbound action script that is supposed to create a record. I can see the email received in the instance but the record is not being created. In the email logs it says "record not created or updated using current". To investigate this I have added a few gs.info(); statements and I was able to trace the point where the code is terminating which is halfway through the code. I was also able to create a record using current.insert(); at the point where the last gs.info(); statement was getting logged. But I want to know what exactly is causing the code to terminate and not execute further after that point.
Tried the script debugger but I'm unable to trigger the Script debugger to fire after setting a breakpoint either by sending a new email or by reprocessing the email. It still says "Status: WAITING_FOR_FIRST_BREAKPOINT".
Help is greatly appreciated if someone figures a way to trigger the script debugger in the inbound actions script. TIA.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-07-2022 02:11 AM - edited ‎11-07-2022 02:19 AM
Hi @Vishal Pallikon ,
With script debugger, that's right you can't do it. How I do for inbound is I dry run the code with the information that comes in and try to analyze how system would interpret it. And ofcourse gs.log() the traditional way. If code is short then I copy it to the background script glide record the email and replace all the "current" with gr and try my code which will not help in your case as you mentioned it's a 300 lines of code. So log() is the only way you are left with.
One Gloden Rule to figure it out IF debugger will invoke or not. Just put one line at the start of your code :
gs.log( "Debugger will invoke - "+ gs.isInteractive() )
If gs.isInteractive() returns true then it will invoke the debugger else NOT.
I hope this help.
Please mark this helpful if this helps and Accept the solution if this solves your issue.
Regards,
Kamlesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-06-2022 10:48 AM
Click the highlighted icon on the inbound action record:
and refer to:

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-06-2022 10:58 AM - edited ‎11-06-2022 10:59 AM
Checkout below article link, should help you fix it:
Can we debug the action in Inbound email using script Debugger?
Aman Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-06-2022 11:40 PM
What you provided works for business rules when you update a certain record that uses that business rule. But for the life of me I can't fire the debugger in the action script by sending a new email or reprocessing an existing email. This is a literal nightmare debugging a 300 line Js code in servicenow and there is no proper documentation on how exactly this can be achieved, everyone's talking about the business rules. Hey!!! what about the inbound actions? Isn't that a thing?!! My code is a mess filled with several gs.info()'s. They provide a script debugger button on top of the action script console but not tell you how you can actually get it to work. This is a serious problem. It would be really helpful if you provide some sources that were successful in achieving my requirement. Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-07-2022 12:23 AM - edited ‎11-07-2022 12:32 AM
Hi @Vishal Pallikon ,
I can understand the frustration with debugger issue that you are going through. Once I also had this, but once I realized how it works, and thank god it do not work the way we want this to work, I overcame this. Just to let you know in case you have not noticed, Script debugger only works when whatever script that you execute is executing SYNCHRONOUSLY. Any script that executes ASYNCHRONOUSLY, will not invoke script debugger, even for the script include to debug you will have to execute synchronously, it won't invoke if called from GlideAjax for the same reason of being asynchronous in nature.
Now let's think it this way, you want to stop debugger at the point of time when you your-self are not sure when this is going to happen; code execution can't stop executing in future just because there is a debugger waiting for it. It's the same case with inbound, you don't know when email is going to be received. To prove the point same happens with BR as well, although you can bebug your BR using debugger but there is one BR 'async' that you can't debug using the same approach, WHY? Simply because it executes asynchronously which happens at some poin of time in future.
So at last to conclude, you can debug your server script using debugger only when your code executes synchronously, any asynchronous code will not be considered by debugger.
I hope this help.
Please mark this helpful if this helps and Accept the solution if this solves your issue.
Regards,
Kamlesh