Fetching records from Zoho CRM through a sub-form

Fetching records from Zoho CRM through a sub-form

Hi,

 

I have some issue with my app.

I added a sub-form “Operation Subform” in the “New Purchase” form.

The Operation Subform fetches records from SalesOrders and CustomerModule1 modules of Zoho CRM, based on the lookup field Order Number.

When I try to run the subform in the New Purchase form it gives an error (something with the zoho.crm.getRecord).

 

The script is the following:   

 

 

//Auto populate from Zoho CRM.

 

Order_Number_ID = 0;

for each operation in Add_Operations

{

crmOrders = zoho.crm.getRecordById("SalesOrders", input.Order_Number_ID);

input.Contact_Name = crmOrders.get("Contact Name");

input.Billing_Country = crmOrders.get("Billing Country");

input.Order_Date = (crmOrders.get("Created Time")).toDate();

operationsList = zoho.crm.getRecords("CustomModule1");

 

opeartionsTotal = 0;

for each operationDet in operationsList

{

    operationNumber = (operationDet.get("Order number")).toLong();

    if (equalsIgnoreCase(operationNumber.toString(),input.Order_Number_ID.toString()))

    {

        input.Quantity_For_This_Op = (operationDet.get("Quantity For This Op")).toLong();

        input.Unit_Sale = (operationDet.get("Unit Sale")).toDecimal();

    }

}

opeartionsTotal = (opeartionsTotal  +  operation.Assigned_Quantity);

}

input.Total_Assigned_Quantity = opeartionsTotal;


Also, please pay attention that the Total_Assigned_Quantity = total of all the Assigned_Quantity of the lines/records in the subform

 

Please help with the scripting,

Thank you