Add item in zoho books from zoho crm

Add item in zoho books from zoho crm

Hi,

i am trying to add item just below in the existing item from zoho crm into zoho books.

i tried this code as below:

opportunityRecord = zoho.crm.getRecordById("Deals",dealID);
upgrade_program = opportunityRecord.get("Upgrade_Program");
//info upgrade_program;
//
productID = upgrade_program.get("id");
productRecord = zoho.crm.getRecordById("Products",productID);
unit_price = productRecord.get("Unit_Price");
//info unit_price;
//
mp = Map();
mp.put("Upgrade_Program_Price",unit_price);
//mp.put("Upgrade_Invoice_Updated",true);
// updateRecord = zoho.crm.updateRecord("Deals",dealID,mp);
//info updateRecord;
////////
//add the same product in the z-Books
invoiceID = opportunityRecord.get("Books_Invoice_Id");
info invoiceID;
product_name = productRecord.get("Product_Name");
description = productRecord.get("Descriptioin");
//
itemList = List();
item1 = Map();
item1.put("item_id",invoiceID);
item1.put("rate",unit_price);
item1.put("quantity",1);
itemList.add(item1);
info itemList;
invoiceMap = Map();
invoiceMap.put("line_items",itemList);
response = zoho.books.updateRecord("Invoices",invoiceID,invoiceMap,"crm_to_books");
info response;

but i am getting error as ,
Failed to execute function
  • Argument type mismatch - Found 'TEXT' but Expected '[MAP]' for the function '519' Line Number:106