Help with custom Function

Help with custom Function

Hi zoho community,

I am trying to create a custom function, but with no success so far. I would like the function to add elements to the inventory (stock) and update the status of the element too, having a button for each element row in the report (currently I am trying to use it in the Purchase order form report, but I also would like to have something similar in the purchase detail report).

the related forms and reports are the following.

Add product form: this form report = inventory

product code
description (lookup to product catalogue)
stock
Threshold value
required purchase

Purchase order form:

name
date
area
purchase detail (subform)
status1

Purchase detail form:

Product code
description (lookup to Add_Product)
quantity
status

and this is the script I am trying:

void purchase.postToInvent(Purchase_Order purRow)
{
    proRowList = purRow.Purchase_Detail;
    for each proRow in proRowList
    {
        fet  =  Add_Product [ID == proRow.Description];
        fet.Stock = (fet.Stock  +  proRow.Quantity);
        thisapp.inventReportColor(fet.ID);
    }
    purRow.Order_Status1 = "Received";
}

So far, I can create the custom action, i can see the button in report for each record, but when I click on it nothing happens :(


So if anyone knows what the problem is or has a better way to achive this please give a hand. Any help will be appreciated.