Forum Discussion

WilliamHunter2's avatar
WilliamHunter2
Qrew Member
2 years ago

Advanced Pipeline Logic

Okay via a pipeline, thanks to Chayce Duncan, I was able to implement the below logic. What this does is sends a report to our foreman every day at 6pm, if they have not approved a time entry. I have recently discovered that we have 30+ foreman. This of course would require us to make 30+ reports and pipelines customized to each one of them. My question now is will it be possible to take a report with all of the foreman on it and somehow dynamically filter with a single pipeline. For example the report will have the following foreman who have not made time approvals:

Chuck 

Frank

Dan

and at 6 pm each day I want to email only the the foreman's unapproved time entries to the respective foreman, so I do not want Chuck to get Frank's and etc. If someone could walk me through that logic I would greatly appreciate it. 



------------------------------
William Hunter
------------------------------
  • William,

    I would not have the Pipeline send the email. 

    Instead I would build a Notification in the QB table to send emails to Foreman for the person on the unapproved Time Card.   This requires that in your architecture the User for the Foreman is part of the relationship down to the time card.   Here is an example

    The Pipeline would fire at 6:00 PM and go through the unapproved Time Cards and toggle a Checkbox, Email Notification, that sends the Notification.

    Your Notification then goes to the correct User thanks to the wizardry in Quickbase.



    ------------------------------
    Don Larson
    ------------------------------
    • ChayceDuncan's avatar
      ChayceDuncan
      Qrew Captain

      I would provide an alternate view to Don's in that if a foreman has 20 unapproved entries you don't want to fire off 20 emails to them and have their inbox full of unapproved requests. 

      There is a non-pipeline email solution similar though that you have a table of foreman that you query via Pipelines every day at 6pm, if they have unapproved time entries then you send them an email via Pipelines or basic QB notifications and in the body of the email you send them a link to a report in QB that is a filtered report to them as a foreman of their pending approvals. The body of the email will not include the actual entries in table format, but it would alert them with general specifics all the same. 

      If you're still set on using Pipelines, you can either 1) modify your pipeline and loop through the foremen with outstanding approvals and for each formeman query their approvals and send it similar to how you already are. This method is pretty taxing though in that if you have 30 foremen with pending entries you'd be querying 30 times which is a lot for a simple process. You could instead query for all outstanding entries, and then do a loop of your foreman and instead of re-querying for their specific entries, do the JSON loop that you're doing for the email and add an IF condition to the JSON string that the foreman on the time entry has to be the same foreman that you're currently sending the email to.



      ------------------------------
      Chayce Duncan
      ------------------------------
      • DonLarson's avatar
        DonLarson
        Qrew Elite

        I agree with Chayce.   More than one email a day about Timecards will make you unpopular with the Foreman.   The architecture change is to add Summary Fields in the relationships.

        Your Pipeline Search Step is looking for records in the Foreman table where the # of Unapproved Time Cards > 0.   Then check the Email box and then uncheck it so it is blank for tomorrow.

        Your Notification is part of the Foreman's table but has a Link to the Time Cards Table where you filter on Foreman User.

        Now you do not need any JSON at all.

        Do it the way Chayce suggested.



        ------------------------------
        Don Larson
        ------------------------------