report.submitterEmail

Z1ablZ1abl Expensify Customer Posts: 8 Expensify Newcomer

Hello,

The API response for submitterEmail has no value, any idea how can I get submitterEmail value via API?

Best Regards,

Edward

Answers

  • Rachael HopkinsRachael Hopkins Expensify Success Coach - Admin Posts: 772 Expensify Team

    Hi @Z1abl I think you are looking for accountEmail

    Do you use this guide at all? I find it incredibly useful!

  • Z1ablZ1abl Expensify Customer Posts: 8 Expensify Newcomer

    Hey @Rachael Hopkins :)

    Cool, thanks. I also checked accountEmail but accountEmail is not a submitterEmail, who submitted an expense.

    When I add a copilot to account A, next this copilot submits an expense on behalf of account A and API returns as accountEmail just email address of account A, but expense was submitted from copilot's email.

  • Christina DobryzynskiChristina Dobryzynski Expensify Success Coach - Admin, Expensify Team Posts: 214 Expensify Team

    Thanks for giving that a try  @Z1abl 

    According to our API docs - submitterEmail is the email address of the person that created the report.

    Because a copilot submits a report from within the report creator's account, I don't think there is a method to obtain the copilot email address as the submitter. 

    Let's open this up to the Expensify Community to see if anyone has a suggestion on how to obtain the copilot details when submitting a report. Please feel free to reach out with any questions!

  • Ted HarrisTed Harris Expensify Success Coach - Admin Posts: 304 Expensify Team

    Hi @Z1abl - I think this should be possible. Something like this in your report logic:

        <#assign copilot = "">
        <#list report.actionList as action>
            <#if action.action == "BILLABLEDELEGATE">
                <#if action.details.actionTaken == "SUBMITTED">
                    <#assign copilot = action.accountEmail>
                    <#break>
                </#if>
            </#if>
        </#list>
    

    And then later in the template you can just populate the Copilot if it exists:

    <#-- Copilot -->${copilot},<#t>
    

    👍

  • Z1ablZ1abl Expensify Customer Posts: 8 Expensify Newcomer

    Hi @Ted Harris,

    Thank you!

    I checked this workaround and in general it works but the result is:

    accountEmailCopilotEmail instead of CopilotEmail:

    [email protected]@copilot.ninja instead of [email protected]

    Do you have maybe idea why it's concatenated without any space between two values?

  • Jeremy BonifaceJeremy Boniface Expensify Team Posts: 143 Expensify Team

    Jeremy stepping in here for Ted while he's offline. I'm wondering -- can you share your code? I'd like to take a closer look.

  • Z1ablZ1abl Expensify Customer Posts: 8 Expensify Newcomer

    Sure, here is the part of template with logic:

    </#if>

    <#list reports as report>

    <#list report.transactionList as expense>

    <#if expense.modifiedMerchant?has_content>

    <#assign merchant = expense.modifiedMerchant>

    <#else>

    <#assign merchant = expense.merchant>

    </#if>

    <#if expense.convertedAmount?has_content>

     <#assign amount = expense.convertedAmount/100>

     <#elseif expense.modifiedAmount?has_content>

     <#assign amount = expense.modifiedAmount/100>

     <#else>

     <#assign amount = expense.amount/100>

     </#if>

     <#if expense.modifiedCreated?has_content>

     <#assign created = expense.modifiedCreated>

     <#else>

     <#assign created = expense.created>

     <#assign category = expense.category>

     <#assign mcc = expense.mcc>

     <#assign tag = expense.tag>

     <#assign description = expense.description>

     <#assign reimbursable = expense.reimbursable>

     <#assign currency = expense.currency>

     <#assign receipt = expense.receipt>

     <#assign receiptURL = expense.receiptObject.url>

     <#assign receiptID = expense.receiptID>

     <#assign status = expense.status>

     <#assign comment = expense.comment>

     <#assign id = expense.transactionID>

      <#assign copilot = "">

      <#list report.actionList as action>

        <#if action.action == "BILLABLEDELEGATE">

          <#if action.details.actionTaken == "SUBMITTED">

            <#assign copilot = action.accountEmail>

            <#break>

          </#if>

        </#if>

      </#list>

     </#if>


    And next variable is used as:

    ${copilot}

Sign In or Register to comment.