1 Reply Latest reply on May 9, 2017 3:48 PM by Debayan Bhattacharjya

    Tip: Use a Parameter to create a "test mode" for your alert

    Matt Coles

      When you're building an Advanced Alert that is dynamically pushing notifications to arbitrary emails based on your data, you don't want to start running it without testing it. Especially on those alerts that are more complex. Bad joins, messy data, invalid assumptions, and funky HTML formatting can get in the way of a good experience for your users. So it goes without saying that you should test it on yourself first.


      One solution to this need is to use a Parameter as a toggle button of sorts for putting your alert in "test mode". This allows you to safely change your alert with a single click, and know that only you will receive emails, not your users. The added benefit of building this up front is that at some point you'll want to change your alert once again, and it's nice to not have to think about the field edits you'll need to make once again, simply so you don't make a fool out of yourself!


      Here's how to do it. First, create a Parameter of type boolean, called "Test Mode":




      Create another parameter of a String type, called "Test Email":



      This will be the email address that all email is sent to when Test Mode is on.



      Now, in your Email To * field, let's say you were emailing people based on some field in your data--in this case, a field in your data called "Owner Email":



      Edit the calc so that when the Test Mode parameter is set to True, it emails the Test Email instead of the usual address:



      Even if you aren't actively using Email CC, or BCC in your VizAlert, I recommend making a similar modification on those fields as well, because you may decide to add them at some point, and this way you don't have to remember to change them:



      Now because you could be sending multiple emails in your test, and they're all now being sent to just you, you'll need a way to determine which email was supposed to go to which address. We can encode that information into the Subject field. Let's say we had this as our Subject:



      We can change it to the following, and the name of the person being emailed will be added to it when we're in Test Mode:




      Okay! Let's see what our VizAlert will send in normal mode:



      And if we flip the Test Mode parameter to True, we get:





      Please make sure you are changing this parameter value in Desktop, and re-publishing the entire workbook before testing, or use Web Edit and save over your existing viz. Don't make the change while simply viewing the viz on Server unless you really know what you're doing, as the change won't apply to the VizAlert unless the change is saved as a Customized View, and it is made the default. Best practice: Big changes? Desktop. Small tweaks? Web Edit.



      So there you go. Test those alerts! You'll be happy you did!