How to run javascript in a flow?

The Run Javascript is used to call a javascript function.

Try adding something like this to the bottom of your page:

<script>
    function displayToast() {
		

		toastr.options = {
		  "closeButton": false,
		  "debug": false,
		  "newestOnTop": false,
		  "progressBar": false,
		  "positionClass": "toast-top-full-width",
		  "preventDuplicates": false,
		  "onclick": null,
		  "showDuration": 300,
		  "hideDuration": 1500,
		  "timeOut": 5000,
		  "extendedTimeOut": 1000,
		  "showEasing": "swing",
		  "hideEasing": "linear",
		  "showMethod": "fadeIn",
		  "hideMethod": "fadeOut"
		}

          toastr["error"]("Your username or password was incorrect.", "Invalid Login!")
    }

</script>

Then in your flow on unauthorized, add a Run javascript action and just provide the function name displayToast

Now if this is the only thing you are doing, you could skip the Flow and use a Static event on unauthorized (instead of dynamic) and just call the function displayToast()

2 Likes