toggle scripting in flow designer Error Handler
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2024 12:25 AM
Can't I use toggle scripting on Error handler? If possible, please let me know how to do it
[not Error Handler]
[Error Handler]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2024 01:24 AM - edited 06-28-2024 01:26 AM
Hi @BoHyun Jung,
Yes, you can use toggle scripting on an Error Handler in ServiceNow. The toggle scripting feature allows you to enable or disable scripting for specific activities, including Error Handlers. Here’s how you can do it:
Navigate to the Flow Designer:
- Go to Flow Designer by typing Flow Designer in the application navigator and selecting it from the list.
Open Your Flow:
- Find and open the flow you want to add an Error Handler to.
Add an Error Handler:
- Click on the action or flow logic where you want to add the Error Handler.
- Click on the More options (three dots) and select Add Error Handler.
Toggle Scripting:
- In the Error Handler configuration, you will see an option to toggle scripting.
- Click on the Toggle Scripting button. This will switch the view from the standard interface to a script editor.
- Script:
(function execute(inputs, outputs) {
// Custom error handling logic
var errorMessage = 'An error occurred in the flow: ' + inputs.error.message;
gs.error(errorMessage);
// Optional: create a task or notify users
var gr = new GlideRecord('incident');
gr.initialize();
gr.short_description = 'Flow Error';
gr.description = errorMessage;
gr.insert();
})(inputs, outputs);
Save your changes and make sure the flow is activated for the changes to take effect.
Thank you, please make helpful if you accept the solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2024 01:30 AM
Hi @Yashsvi
Can you capture the screen for me to understand?
I don't understand what you mean by just looking at the writing.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-30-2024 05:40 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2024 12:21 AM
Hi Bo,
Please see attached gif file you should be able to see the toggle script option under error handler for some of the actions and flow logic like this
Feel free to mark this answer helpful if this answers your query