Qlik Community

Ask a Question

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
QlikWorld Online 2021, May 10-12: Our Free, Virtual, Global Event REGISTER TODAY
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Automatic Alerts(Email)

Hi community,

is there any way to get Alert mesages in QlikSense, when for example a kpi goes into a critical status or some critical values get loaded into the programm?

So u get a Email or ans SMS.

I saw this for  QlikView but it is also possible to get it in QlikSense?

CREATING AUTOMATED ALERTS AND EMAILS SENDING BASED ON DATA LOADED IN QLIKVIEW.docx

13 Replies
undergrinder
Specialist II
Specialist II

Hi Eric,

This is not possible in Qlik Sense.

You can implement a workaround in the load script.

You can make and execute a batch file from load script, that do the work.

You should set legacy mode to execute batch files from script.

G.

petter
MVP
MVP

You could achieve this with a properly designed load script depending on whether the KPI is easily determined in the data model that is created in the load script. This is the documentation that tells how to use EXECUTE statement from a load script: http://help.qlik.com/en-US/sense/2.1/Subsystems/Hub/Content/Scripting/ScriptRegularStatements/Execut...

So depending on your level of expertise it might not be so complicated to achieve...

reddy-s
Master II
Master II

Hi Eric,

Yes this is possible using extensions for sure. You can build an extension to read a KPI using the data from a hypercube and conditionally run your PHP code to send an email.

I have implemented something similar this using Python to read the log files, to notify any reload failures:

Capture.PNG

Thanks,

Sangram.

Not applicable
Author

Would you mind to share the example?

reddy-s
Master II
Master II

Hi Rosie,

Sure will do, its a python code. i will post in in the same thread tomorrow.

Thanks,

Sangram.

Not applicable
Author

many thanks~

reddy-s
Master II
Master II

Hi Rosie,

Here is the code, which was built for my requirement and has to be tweaked a bit to meet yours if necessary.

import smtplib

from email.mime.multipart import MIMEMultipart

from email.mime.text import MIMEText

Error_Suspects = ['Error', 'ERROR', 'Failed', 'Failure']

def detect_suspects(file_path, word_list):

    with open(file_path) as LogFile:

        Summary = {word:[] for word in word_list}

        failure = ':'

        for num, line in enumerate(LogFile, start=1):

            for word in word_list:

                if word in line:

                    failure += '<li>'+line+'</li>'

    return failure

Result = detect_suspects(r"C:\Users\sangramr\Desktop\Error_File.log", Error_Suspects)

def py_mail(SUBJECT, BODY, TO, FROM):

    MESSAGE = MIMEMultipart('alternative')

    MESSAGE['subject'] = SUBJECT

    MESSAGE['To'] = TO

    MESSAGE['From'] = FROM

    MESSAGE.preamble = """    """

    HTML_BODY = MIMEText(BODY, 'html')

    MESSAGE.attach(HTML_BODY)

    server = smtplib.SMTP('smtp.company.local',25)

    if __name__ == "__main__":

        server.set_debuglevel(1)

    server.sendmail(FROM, [TO], MESSAGE.as_string())

    server.quit()

if Result != None:

    if __name__ == "__main__":

        """Executes if the script is run as main script (for testing purposes)"""

        email_content = """

       <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>Qlik Sense Alerts!</title>

</head>

<body bgcolor="#8d8e90">

<table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#8d8e90">

  <tr>

    <td><table width="600" border="0" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF" align="center">

         <tr>

          <td align="center"><font style="font-family:'Myriad Pro', Helvetica, Arial, sans-serif; color:#68696a; font-size:36px; text-transform:uppercase"><strong>Qlik Sense Alerts!</strong></font></td>

        </tr>

        <tr>

          <td align="center"><a href= "" target="_blank"><img src="http://us.analytics8.com/images/uploads/general/762/qlikmaps-2.png" alt="" width="598" height="249" border="0"/></a></td>

        </tr>

        <tr>

          <td><table width="100%" border="0" cellspacing="0" cellpadding="0">

              <tr>

                <td width="7%"> </td>

                <td width="58%" align="left" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">

                  <tr>

                    <td> </td>

                  </tr>

                  <tr>

                    <td align="left" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">

                      <tr>

                        <td width="95%"><table width="100%" border="0" cellspacing="0" cellpadding="0">

                          <tr>

                            <td height="35" align="left" valign="middle" style="border-bottom:2px dotted #000000"><font style="font-family: Georgia, 'Times New Roman', Times, serif; color:#000000; font-size:25px"><strong><em>Error Information</em></strong></font></td>

                          </tr>

                          <tr>

                            <!-- our content -->

                            <ul> Error List

                             """

        email_content += Result

        email_content += """

                        </ul>

                          </tr>

                        </table></td>

                        <td width="5%" style="border-right:2px dashed #95989a"> </td>

                      </tr>

                    </table></td>

                  </tr>

                </table></td>

              </tr>

            </table></td>

        </tr>

        <tr>

          <td> </td>

        </tr>

        <tr>

          <td align="center"><font style="font-family:'Myriad Pro', Helvetica, Arial, sans-serif; color:#231f20; font-size:8px"><strong>Your Company Name | <a href= "http://google.com" style="color:#010203; text-decoration:none">data@company.co.uk</a></strong></font></td>

        </tr>

        <tr>

          <td> </td>

        </tr>

      </table></td>

  </tr>

</table>

</body>

</html>

         """

        TO = 'sangramreddy@company.co.uk'

        FROM ='data@company.co.uk'

        py_mail("Qlik Sense Alerts!", email_content, TO, FROM)

Thanks and Regards,

Sangram.

vikasmahajan
Champion
Champion

Hi Sangram Reddy,

Can you please give step by Step  guide lines  so that  new to QlikSense can achieve this approach ?

Thanks

Vikas

ngulliver
Partner
Partner

Hi, Vikas.

You will need to to use the free Qlik Web Notification Connector to create an alert in QlikSense. Have a look at this blog for more details of how to use the connectors..

https://www.quickintelligence.co.uk/free-qlik-web-connectors/