Can anybody help with this issue : "Could not process template","responseCode":500

dianagandianagan Posts: 6 Expensify Newcomer

I am trying to run a template that previously been working but now I get the following error message:

{"responseMessage":"Could not process template","responseCode":500}

I searched but cannot find any information on this message and what maybe the cause.

Best Answers

  • dianagandianagan Posts: 6 Expensify Newcomer
    Accepted Answer

    The template looks like this:

    {
    "reports": [
    <#if addHeader == true>
    <#assign reportNumber = 1>
    <#assign expenseNumber = 1>
    <#list reports as report>
    <#if reportNumber != 1>
    ,
    </#if>
    {
    "ReportID": ${report.reportID},<#t>
    "ReportDate": "${report.created}",<#t>
    "AccountEmail": "${report.accountEmail}",<#t>
    "Currency": "${report.currency}",<#t>
    "Total": ${report.total/100},<#t>
    "Status": "${report.status}",<#t>
    "expenses": [
    <#list report.transactionList as expense>
    <#if expenseNumber != 1>
    ,
    </#if>
    {
    "ReportID": ${report.reportID},<#t>
    "G/LAccount": ${expense.categoryGlCode},<#t>
    "Category": "${expense.category}",<#t>
    "ExpenseDate": "${expense.created}",<#t>
    "JobNo": "${expense.tagGlCode}",<#t>
    "Currency": "${report.currency}",<#t>
    "Amount": ${expense.convertedAmount/100},<#t>
    "TransactionID": ${expense.transactionID},<#t>
    "Billable": "${expense.billable?string("true","false")}",<#t>
    "Reimbursable": "${expense.reimbursable?string("true","false")}",<#t>
    "Comment": "${expense.comment}",<#t>
    "ReceiptURL": "${receiptObject.url}"<#t>
    <#assign expenseNumber = expenseNumber + 1>
    }
    </#list>
    ]
    <#assign reportNumber = reportNumber + 1>
    <#assign expenseNumber = 1>
    }
    </#list>
    ]
    }

    I am running a shell script via "Git Bash Here" which calls to this template.

    curl -X POST 'https://integrations.expensify.com/Integration-Server/ExpensifyIntegrations' -H 'Expect: ' -d @xxx.json --data-urlencode '[email protected]'

  • FrancoisFrancois Posts: 7 Expensify Success Coach
    Accepted Answer

    Hi there,

    Your template is missing a closing </#if> statement. I suggest you modify your template as follows:

    <#if addHeader>
    {
        "reports": [
    </#if>
            <#list reports as report>
            {
                "ReportID": ${report.reportID},
                "ReportDate": "${report.created}",
                "AccountEmail": "${report.accountEmail}",
                "Currency": "${report.currency}",
                "Total": ${report.total/100},
                "Status": "${report.status}",
                "expenses": [
                <#list report.transactionList as expense>
                    {
                    "ReportID": ${report.reportID},
                    "G/LAccount": ${expense.categoryGlCode},
                    "Category": "${expense.category}",
                    "ExpenseDate": "${expense.created}",
                    "JobNo": "${expense.tagGlCode}",
                    "Currency": "${report.currency}",
                    "Amount": ${expense.convertedAmount/100},
                    "TransactionID": ${expense.transactionID},
                    "Billable": "${expense.billable?string("true","false")}",
                    "Reimbursable": "${expense.reimbursable?string("true","false")}",
                    "Comment": "${expense.comment}",
                    "ReceiptURL": "${receiptObject.url}"
                    }<#sep>,</#sep>
                </#list>
                ]
            }<#sep>,</#sep>
            </#list>
    <#if addFooter>
        ]
    }
    </#if>
    

    Cheers

  • Nick_TorneseNick_Tornese Posts: 3 Expensify Newcomer
    Accepted Answer

    Three parts. Like this: ${expense.receiptObject.url}

Answers

Sign In or Register to comment.