Subform picklist problem

Subform picklist problem

I mailed support about his problem a few days ago, but have had no response other than "we will respond soon". So I thought I'd try my luck here.

I was running the script below on the On Edit > On Load action of a parent form to populate dynamic picklists on a subform with the data that was saved previously. This has been working fine until a few days ago. When I made a change to a different line in the script totally unrelated to this code I got an error message saying "variable record not defined"


for each record in Items
{
    tempProduct = record.Product;
    clear record.Product;
    Items.Product:ui.append(tempProduct);
    record.Product = tempProduct;
    tempProduct_Type = record.Product_Type;
    clear record.Product_Type;
    Items.Product_Type:ui.append(tempProduct_Type);
    record.Product_Type = tempProduct_Type;
}

There are three picklists "Category" "Product" and "Product Type" each one populated based on the selection made in the previous picklist. If I put the script on the subform's Category > On User Input I can get it to work, but that means the user will have to re-select each item in the category field to get the correct values in all the others.

Any suggestions?