Autopopulate value in sub-form

Autopopulate value in sub-form

Hi,

I have a main form with sub-form that fetches another form. Sub-form has product related fields. What I want to do here is, based on the selected product(From CRM Module) I want to fetch its related price to a field. But it is not working as I expected. If my lookup field for product is within creator I dont find any issue. If I want to get the product from zoho crm I am not able to auto-populate unit price field.I don't know what I am missing. Help me sort out this issue

Here is my code, [Products->On User Input Action]

  1. row.Unit_Price = 0.0;
    productsList = zoho.crm.getRecords("Products");
    for each productDet in productsList
    {
        productName = productDet.get("Product Name");
        if (productName.equalsIgnoreCase(row.Products))
        {
            row.Unit_Price = (productDet.get("Unit Price")).toDecimal();
        }
    }