7 Replies Latest reply on Apr 11, 2019 1:23 PM by Matt Coles

    Email based on User

    Amy Garcia

      So we are getting closer to releasing this to our stakeholders. However, there is one request that I can't seem to get working properly. Stakeholders want an csv sent to the individuals that has task pending with them.

       

      Example: The report has a total of 5 rows.

      Sarah has two task in her bucket of work - she would only get a csv containing the two items that relate to her.

      Amy has 3 task in her bucket of work - she would get the 3 items that relate to her.

       

      Is this possible with Vizalerts? Any guidance is appreciated.

       

      Matt Coles

        • 1. Re: Email based on User
          Matt Coles

          Hey Amy. Yes, this is possible with VizAlerts. There are two ways you can do this, and you can see examples of each in the demo\VizAlertsDemo.twb workbook, under the "Advanced Alerts Demo" sheet. Look at tests 20 and 29:

           

           

          Test 20 shows how multiple attachments can be added to a single email simply by specifying multiple content references after each other in the Email Attachment field. Easy to understand and use, but not great when the number of attachments you want to add can fluctuate.

           

          Test 29 shows a solution for that case. In this example, multiple lines of data are consolidated into a single email based on having the same recipient list and subject line. This behavior is triggered by the presence of the Consolidate Lines field (not the value of that field). All Email Body lines will be concatenated together into a single email body, and all Email Attachment lines will be added to the same email as separate attachments. In the example you can see that only one of the three Email Body fields has any data, and the rest are NULL. This prevents the same body text from being re-written three times. We cheated a bit here because our data source is Excel, so it was hand-edited to be that way. In real life, specifying a value for only the first mark of a set of marks can be a bit tricky to do in Tableau without an LOD calc of sorts. However, an easier solution is to simply use the Email Header field to write your body text, as it will only be written for the first record out of all of those that constitute a single email.

           

          Hope that makes sense. I recommend playing around with those two tests, especially 29, on your Server and build some familiarity with how it can work for you. In a nutshell, you'll likely want one mark per email attachment that needs to be sent, then use the Consolidate Lines feature to group them all into the appropriate emails.

          • 2. Re: Email based on User
            Amy Garcia

            Matt Coles Ok so I think I am missing a step. I created the consolidate lines and sort order and added it to the report. But when I trigger Vizalerts I am still getting all of the data not just the data related to myself.

             

             

            This is what I have in the VIZ_CSV(CheckRequestStatusReview_0/K2CheckRequestReport-NoSecurity).

             

            Do I have to specify each user? example.

             

            VIZ_CSV(CheckRequestStatusReview_0/K2CheckRequestReport-NoSecurity?Userid=59633)

            VIZ_CSV(CheckRequestStatusReview_0/K2CheckRequestReport-NoSecurity?Userid=54183)

            • 3. Re: Email based on User
              Matt Coles

              Yes, exactly. You would customize each attachment based on individualized filters passed to the content reference via URL parameters just like you've shown.

              • 4. Re: Email based on User
                Amy Garcia

                I tried that but it still send me the entire content of the data. Also, do I need to create a new calculated field for each person.  in this case I would have 2 VIZ_CSV() - CSV columns. Matt Coles

                • 5. Re: Email based on User
                  Matt Coles

                  I tried that but it still send me the entire content of the data.

                  Something may be wrong with the way you've specified the URL parameter. Check it in your browser and make sure it works there: http://yourserver/views/CheckRequestStatusReview_0/K2CheckRequestReport-NoSecurity?Userid=59633&:format=csv

                   

                  Also, do I need to create a new calculated field for each person. in this case I would have 2 VIZ_CSV() - CSV columns

                  Nope. You will construct the content reference as a dynamic string calc in Tableau:

                   

                  'VIZ_CSV(CheckRequestStatusReview_0/K2CheckRequestReport-NoSecurity?Userid=' + STR([User Id] + ')'

                  • 6. Re: Email based on User
                    Amy Garcia

                    Matt Coles So the link worked in the sense that it provided a csv file but it still did not limit the data. I still got all of the rows.  

                     

                     

                    There has to be some disconnect. I still don't fully understand how it would know to only send me the data for 59633. Let me show you how I have it set up.

                    Email Attachment : 'VIZ_CSV()'

                    Email Action :1

                    Email to : 'amy.garcia@domain.com'

                    VIZ_CSV() : 'VIZ_CSV(CheckRequestStatusReview_0/K2CheckRequestReport-NoSecurity?Userid=' + STR([User Id]) + ')'

                    Consolidate Lines : str(null)

                    sort order: STR(INDEX()%2)

                     

                    The part that seems puzzling to me is, how does it know to related the rows for 59633 to amy.garcia@domain.com? vice versa for other employee.

                    • 7. Re: Email based on User
                      Matt Coles

                      Ok, I see I didn't quite get the "work bucket item" bit. Let's back up to the original use case you shared:

                       

                      Stakeholders want an csv sent to the individuals that has task pending with them.

                       

                      Example: The report has a total of 5 rows.

                       

                      Sarah has two task in her bucket of work - she would only get a csv containing the two items that relate to her.

                       

                      Amy has 3 task in her bucket of work - she would get the 3 items that relate to her.

                       

                      To accomplish this, you really only need a data set for all the individuals that are assigned work items. It needs to contain (at least) the following basic fields:

                       

                      • Individual ID
                      • Individual Email Address

                       

                      You'll then construct your Email fields based on those base fields. Critically for your question:

                       

                      • Email To = [Individual Email Address]
                      • Email Attachment = 'VIZ_CSV(CheckRequestStatusReview_0/K2CheckRequestReport-NoSecurity?Userid=' + STR([Individual ID]) + ')'

                       

                      The association between the attached report and the individual is that you are using their email address in Email To, and their User ID in the content reference for the attachment.