Question:
Could someone tell me if the problem causing the 500 Error messages I keep getting from Zapier is with the backend code pasted below?
'use strict';
import wixData from 'wix-data';
import {ok, response} from 'wix-http-functions';
export function post_storerecords(request) {
return request.body.json()
.then(body => {
let recordInsert = {
"invoiceNo": body.InvoiceNo,
"dueDate": body.DueDate,
"customer": body.Customer,
"amount": body.InvoiceStatus,
"balance": body.Balance,
"invoiceStatus": body.InvoiceStatus,
"pdf": body.PDF,
"firstName": body.FirstName,
"lastName": body.LastName,
"email": body.Email
};
return wixData.insert('QBOInvoices', recordInsert)
.then(result =>ok({body: JSON.stringify(result)}))
.catch(err => response({status: 500, body: err}));
});
}
Product:
Wix Editor
What are you trying to achieve:
Hello! I am successfully using Zapier to add a new row to a Google Sheet when a new invoice is generated in QBO. I want to use Zapier to push new spreadsheet rows into a Wix CMS database named QBO Invoices.
What have you already tried:
I have created the action in Zapier and followed the instructions in this video to add backend code to my website, but I get a 500 error message from Zapier when I test the action.
Additional information:
[Include any other pertinent details or information that might be helpful for people to know when trying to answer your question.]