General Discussion

 View Only
  • 1.  Hours Receipt Email Destination

    Adopter
    Posted 03-13-2024 12:48

    Hello, has anyone generated an hours receipt for their team as an email Destination?

    In our Daily Work Report, we have a repeat section for each crew member with general info (name, per diem for the day, etc.) with a nested repeat section for hours, job classification, and activity performed for those hours. We would like to set up an Email Destination that sends our team their hours, but only the hours under their repeat section. We know how to build out the nested repeat sections in DREL, but we really want our team to only get the hours that they worked, not the whole crews' hours. As a note, each employee's email is extracted when their name is selected from a list.

    Example: Employee 1 worked 2 hours as an operator, 3 hours as a general laborer, and 2 hours as a driver. Employee 2 worked 5 hours general labor and 2 hours as a passenger.

    How do we get Employee 1 their hours without them also receiving Employee 2's hours? 



    ------------------------------
    Connor Smith
    Business Development
    Anderson Environmental Contracting, LLC
    ------------------------------


  • 2.  RE: Hours Receipt Email Destination

    Posted 03-15-2024 13:39

    Hey Connor!

    Thanks for the question and let me try and get you going in the right direction, this post might be a little long and I hope I can articulate the concept. I just wanted to also include a couple links to our documentation on some of the topics that I am going to mention below:

    DREL
    Destination Filtering


    The first thing that I do want to mention is that, the only way that we are going to be able to accomplish what you are looking to do is by putting a limit on the number of Employees that can be put into the repeat section. I will explain why we need this to happen but it can be done by limiting the number of rows that a Repeat section can have.

    The reason that we need to put a limit on the rows is because we will need to create a document and a destination per row (per employee) that is in the repeat. If you allow for 10 employees to be added into the repeat, this will mean that you need 10 Destinations configured on the form. 

    Next, do you want to simply include the hours in the body of an email, or would you like to deliver a more "official" document with their hours. If you want to simply include the hours in the body of the email (this is the more simple way) then we will just need 10 email destinations. If you would like to see a PDF attached to the email, we will need to have 10 documents and 10 destinations created. 

    I am going to build out a "form" in here to better explain.

    Repeat Section - Employees (Limit 10 rows)
         Question - Employee Name
         Repeat Section - Hours
                       Question - Number of Hours

    Using DREL, we can pull out specific parts of the repeat section, including specific rows to include and we can also filter destinations based off if there is data in a repeat row or not so that we know when that destination needs to be fired.

    Destination 1 points to Row 1 in the repeat which is the hours for Employee 1
    Destination 2 points to Row 2 in the repeat which is the hours for Employee 2
    .... (and so on)

    Destination 1 Configuration:
    Custom Filter Rule:
    Input Expression: %e[Employees][0][%a[Employee Name]]  (Looking at the first row of the Employees repeat for the Name)
    Filter Expression: ^(?!\s*$).+ (this is looking to see if that question has an answer)
    (This is looking at the first row of the Employees repeat, and the Email question in the first row of the Hours repeat)

    Email BODY:
    "Hello %e[Employees][0][%a[Employee Name]]

    Here are your hours for the week:
    %e[Employees][0][%e[Hours]]

    For the Email BODY, you might need to play around with the formatting of it in order for it to be easily consumed.

    You will then need to repeat this configuration for each row of the repeat section that you will allow in the form.

    Destination 2:
    Custom Filter Rule:
    Input Expression: %e[Employees][1][%a[Employee Name]]  (Looking at the first row of the Employees repeat for the Name)
    Filter Expression: ^(?!\s*$).+ (this is looking to see if that question has an answer)
    (This is looking at the first row of the Employees repeat, and the Email question in the first row of the Hours repeat)

    I hope this helps, let us know if you have further questions



    ------------------------------
    Ian Chamberlain
    Solutions Architect
    TrueContext
    ------------------------------



  • 3.  RE: Hours Receipt Email Destination

    Adopter
    Posted 21 hours ago

    Hi Ian,

    Thank you for the assist. I was finally able to get to this project! 

    Could you explain how to get my emails to the designated crew? I currently have the Crew's email address under the Question Unique IDs for Emails to Extract from the Submitted Form. However, I'm getting the error below when testing.

    For reference, here are the UIDs I'm working with in my Destination:

    • Hour Repeat Section: Crew
    • Crew Name: EEName
    • First Name: EEFirst
    • Email: EEEmail
    • Total Hours: TotalTime
      • This is a Footer in the Crew repeat section that tallies answers from a Nested Repeat
    • Nested Repeat Section: CrewHours
    • Hours entry: Hours
    • Cost code: Function
      • This matters because we have different pay scales on prevailing wage jobs
    • Project name (longhand): [JobDesc]
    • Date: Date

    I've tried the following so far (not all at once, I just added them together for the example)

    I have Filters setup as you suggested. The final version will also have another Filter, I know that one will work so I'm not worried about it.

    Here's what I have thus far in my email body also. I don't know if the info will come through how I want, I was just going to tweak & test until it worked, but I need to get the Destination working before I can do that.

    Hello %e[Crew][0][%a[EEFirst]],

    Below are the hours submitted to payroll for %a[JobDesc] on %a[Date][MM-d-y].

    Total Hours: %e[Crew][0][%a[TotalTime]]

     

    Here is the breakdown of hours:

    %e[Crew][0][CrewHours][%a[Function]: %a[Hours] Hours[,]



    ------------------------------
    Connor Smith
    Business Development
    Anderson Environmental Contracting, LLC
    ------------------------------



Reminder: Content posted to our Community is public content.  Please be careful not to post Intellectual Property that you do not have permission to share.  For more information please refer to our Terms Of Use