Do custom fields in the API actually work???

oschlipfoschlipf Posts: 11 Expensify Newcomer

I am getting empty fields returned from the API for my expense reports for several fields which is puzzling (reimbursable, tagGlCode, receiptObject.url and others). Of particular note are my custom fields employeeCustomField1 and employeeCustomField2. Does anyone have these fields working? If so, can you share how you populated your FTL file and what your setup in the Expensify app looked like for those fields?

Best Answers

  • Ted PeetersTed Peeters Posts: 250 Expensify Success Coach
    Accepted Answer

    Hmmm, thanks for pointing this out @oschlipf. We're looking into this right now.

    In the meantime, could you try using submitterUserID and submitterPayrollID for these? (This is what we used to term those fields before switching them to Custom Fields).

  • Ted PeetersTed Peeters Posts: 250 Expensify Success Coach
    edited March 14 Accepted Answer

    Hi @oschlipf - sorry for the late reply here. I must have missed this.

    I'm pretty sure you'll need to create a list for your attendees in order to call that later in the template - so something like this:

    <#assign attendeeList = "">
    <#list expense.attendees as attendee>
         <#assign attendeeList = attendeeList + attendee.email + ", ">
    </#list>
    

    And then call the list later like:

    "${attendeeList?remove_ending(", ")?replace("\"", "")}"
    

Answers

  • Conor PendergrastConor Pendergrast Posts: 60 Expensify Success Coach

    Hey @oschlipf , happy to help here!

    At a guess, I would assume that the template you're using doesn't have exactly the correct fields. For example, are you using expense.reimbursable, expense.tagGlCode and expense.receiptObject.url?

    On the other hand, the custom fields from the People page are all at the report level, so you can get those via report.employeeCustomField1 and report.employeeCustomField2.

    Does that make sense here Owen? If there's anything else that isn't working, feel free to drop in a little snippet of that template.

  • oschlipfoschlipf Posts: 11 Expensify Newcomer

    Thank you @Conor Pendergrast that was helpful and I'm getting more data now. I am probably still missing something here though because the following fields still come back blank:

        ${report.employeeCustomField1},<#t>
        ${report.employeeCustomField2},<#t>
        ${report.name},<#t>
        ${expense.attendees},<#t>
        ${expense.attendees.displayName},<#t>
        ${expense.categoryGlCode},<#t>
    

    Here is the full FTL file:

    <#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>
    </#if>
    ${report.accountEmail},<#t>
    ${report.employeeCustomField1},<#t>
    ${report.employeeCustomField2},<#t>
    ${report.approved},<#t>
    ${report.reportID},<#t>
    ${report.total},<#t>
    ${amount},<#t>
    ${report.name},<#t>
    ${report.submitted},<#t>
    ${expense.created},<#t>
    ${merchant},<#t>
    ${expense.attendees},<#t>
    ${expense.attendees.displayName},<#t>
    ${expense.reimbursable?string("true", "false")},<#t>
    ${report.accountID},<#t>
    ${expense.tag},<#t>
    ${expense.categoryGlCode},<#t>
    ${expense.tagGlCode},<#t>
    ${expense.ntag1},<#t>
    ${expense.ntag2},<#t>
    ${expense.receiptObject.url},<#t>
    ${report.status},<#t>
    ${report.policyID}<#lt>
    </#list>
    </#list>

  • oschlipfoschlipf Posts: 11 Expensify Newcomer

    This goes right in line with my question above, but how would I make a reference to these highlighted fields below in my FTL file?

  • Ted PeetersTed Peeters Posts: 250 Expensify Success Coach

    Hi @oschlipf - we've fixed this now! So you should be able to use report.employeeCustomField1 and report.employeeCustomField2 instead.

    Thanks so much for pointing this one out!

  • oschlipfoschlipf Posts: 11 Expensify Newcomer

    Thanks for getting that working. I still am not getting any data from this field:

    ${expense.attendees.displayName}

    or

    ${expense.attendees}

    I am probably referencing it wrong in some way as I know it is supposed to return an array, however, I can't find any examples that tell me how to reference it properly.

    Thanks,
    Brian

Sign In or Register to comment.