tried to use the code below to create sales order in zoho books after its created and approved in zoho crm
but am getting the error
//error
Failed to save the function
Not able to find 'getRecordsByID' function Line Number: 3
salesorderID =salesorder.get("salesorder_id");
organizationID = organization.get("organization_id");
data = zoho.crm.getRecordsByID("Salesorders",organizationID,salesorderID);
//info data;
sale = data.get("salesorder").toMap();
productitems = sale.get("line_items").toJSONList();
subtotal = 0.0;
pdlist = List();
for each r in productitems
{
name = r.getJSON("name");
rate = r.getJSON("rate");
quantity = r.getJSON("quantity");
item_total = r.getJSON("item_total").toDecimal();
zohobooksPro = zoho.books.searchRecords("Products","(Product_Name:equals:" + name + ")");
for each ele in crmPro
{
proID = ele.get("id");
}
pro=map();
pro.put("product",{"name":name,"id":proID});
pro.put("quantity",quantity.toLong());
pro.put("list_price",rate.toDecimal());
pro.put("total",item_total.toDecimal());
pro.put("net_total",item_total.toDecimal());
pdlist.add(pro);
}
mp = Map();
mp.put("Subject",sale.get("customer_name"));
mp.put("Account Name",sale.get("customer_name"));
mp.put("Currency", sale.get("currency_code"));
mp.put("Carrier",sale.get("delivery_method"));
billing_address = sale.get("billing_address").toMap();
mp.put("Billing Street",billing_address.get("address"));
mp.put("Billing City",billing_address.get("city"));
mp.put("Billing State",billing_address.get("state"));
mp.put("Billing Code",billing_address.get("zip"));
mp.put("Billing Country",billing_address.get("country"));
shipping_address = sale.get("shipping_address").toMap();
mp.put("Shipping Street",shipping_address.get("address"));
mp.put("Shipping City",shipping_address.get("city"));
mp.put("Shipping State",shipping_address.get("state"));
mp.put("Shipping Code",shipping_address.get("zip"));
mp.put("Shipping Country",shipping_address.get("country"));
mp.put("Salesperson name",sale.get("salesperson_name"));
mp.put("Status",sale.get("status"));
mp.put("Product_Details", pdlist);
c = zoho.books.createRecord("Sales_Orders",mp);
info c;