How to get approvers of a report while it is under processing (not approved yet)

Options
binhnguyendn1606
binhnguyendn1606 Expensify Customer Posts: 8 Expensify Newcomer

Context: we are building a reminder bot that tracks any changes in status of reports.

Question: How can we get the list of approvers (who are supposed to approve the report) while the report is under processing?

Use Case: user A submits a report to user B. reportStatus is processing/submitted.

--> How can we get user B although B has not approved the report?

We tried looking at approvers but this only appears when report has been approved. We also looked at actionList with the hope that there should be info about who is the next user to take action but it doesn't work.

Best Answer

  • Ted Harris
    Ted Harris Expensify Success Coach - Admin, Expensify Team, Expensify Student Ambassador Posts: 359 Expensify Team
    Answer ✓
    Options

    How's this @binhnguyendn1606:

    <#if (addHeader == true)>
      Employee Email,<#t>
      Report ID,<#t>
      Report Name,<#t>
      Submitted Date,<#t>
      Amount,<#t>
      Status (Processing),<#t>
      Total number of Days Awaiting Approval,<#t>
      Current Approver,<#t>
      Number of Days Awaiting Current Approver<#lt> 
    </#if>
    <#list reports as report>
      <#assign daysSinceSubmit = "">
      <#assign daysToApproval = 0>
      <#assign lastApprovalDate = "">
      <#assign submitted = "">
      <#if (report.approvers?size > 0)>
        <#assign lastElement = (report.approvers?size - 1)>
        <#assign lastApprovalDate = report.approvers[lastElement].date?date("yyyy-MM-dd hh:mm:ss")!"">
        <#assign daysToApproval = ((.now?long - lastApprovalDate?long) / (1000 * 60 * 60 * 24))?int>
      </#if>
      <#if report.submitted?has_content>
        <#assign submitted = report.submitted?date("yyyy-MM-dd hh:mm:ss")>
        <#assign daysSinceSubmit = ((.now?long - submitted?long) / (1000 * 60 * 60 * 24))?int>   
      </#if>
      <#if report.status == "Processing">
        <#-- Employee Email -->${report.accountEmail},<#t>
        <#-- Report ID -->${report.reportID},<#t>
        <#-- Report Name -->${report.reportName},<#t>
        <#-- Submitted Date -->${report.submitted?date("yyyy-MM-dd")?string("yyyy-MM-dd")},<#t>
        <#-- Amount -->${(report.total/100)?string("0.00")},<#t>
        <#-- Status (Processing) -->${report.status},<#t>
        <#-- Total number of Days Awaiting Approval -->${daysSinceSubmit},<#t>
        <#-- Current Approver -->${report.managerEmail},<#t>
        <#-- Number of Days Awaiting Current Approver -->${daysToApproval}<#lt>
      </#if>
    </#list>
    

    This should help you towards your goal I hope! The main piece you're looking for is: ${report.managerEmail} though!

Answers