report.submitterEmail

Hello,
The API response for submitterEmail has no value, any idea how can I get submitterEmail value via API?
Best Regards,
Edward
Answers
-
Rachael Hopkins Expensify Success Coach - Admin, Expensify Team, Expensify Student Ambassador Posts: 904 Expensify Team
-
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 Dobryzynski Expensify Success Coach - Admin, Expensify Team, Expensify Student Ambassador Posts: 268 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 Harris Expensify Success Coach - Admin, Expensify Team, Expensify Student Ambassador Posts: 359 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>
👍
-
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 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.
-
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}