I'm trying to create an invoice on Quickbooks from Zoho Creator using the intuit.quickbooks.create deluge command.
How it's supposed to work is that the user selects all the Invoice lines from a report, and then it clicks an "Invoice" button that will execute a function to create the Invoice on Quickbooks.
//Generate Invoice Lines
InvoiceLines = Map();
LineNum = 1;
AllLines = "";
for each line in getRevenues
{
InvoiceLines.put("LineNum",LineNum);
InvoiceLines.put("Description",line.Service_Type);
InvoiceLines.put("DetailType","SalesItemLineDetail");
InvoiceLines.put("Amount",line.Total_Amount);
InvoiceLines.put("SalesItemLineDetail",{"TaxCodeRef":{"value":"6"},"ItemRef":{"name":line.Service_Type,"value":"1"}});
//If it's First Line, do not add ,
if(LineNum == 1)
{
AllLines = AllLines + InvoiceLines;
}
else
{
AllLines = AllLines + ", " + InvoiceLines;
}
//Increase LineNum by 1
LineNum = LineNum + 1;
}
The "AllLines" variable ends being as I want, but when I add it to a Map variabl:
Invoice.put("Line", AllLines);
The Map variable ends up with a lot of "\". Like this:
{"Line":"{\"LineNum\":1,\"Description\":\"Social Media Consulting\",\"DetailType\":\"SalesItemLineDetail\",\"Amount\":1000.00,\"SalesItemLineDetail\":{\"TaxCodeRef\":{\"value\":\"6\"},\"ItemRef\":{\"name\":\"Social Media Consulting\",\"value\":\"1\"}}}, {\"LineNum\":2,\"Description\":\"Strategy\",\"DetailType\":\"SalesItemLineDetail\",\"Amount\":500.00,\"SalesItemLineDetail\":{\"TaxCodeRef\":{\"value\":\"6\"},\"ItemRef\":{\"name\":\"Strategy\",\"value\":\"1\"}}}, {\"LineNum\":3,\"Description\":\"Content Development\",\"DetailType\":\"SalesItemLineDetail\",\"Amount\":2000.00,\"SalesItemLineDetail\":{\"TaxCodeRef\":{\"value\":\"6\"},\"ItemRef\":{\"name\":\"Content Development\",\"value\":\"1\"}}}","CustomerRef":{"value":"xxxx"}}