Fetch and Update and then perform actions on success

Fetch and Update and then perform actions on success

I have two forms:
  • Add_Products
  • Notify
Add_Products holds my stock availability information. Notify contains a list of customers that are signed up to receive an email when the item is back in stock. Both of them share a common field which is Product_Code_SKU.

I have the following script in my Add_Products (On Edit->On Success) form:

  1. if (input.User_Product_Availability  ==  "In stock")
  2. {
  3.     for each OOSItem in Notify  [Product_Code_SKU == input.Output_Product_Code_SKU]
  4.     {
  5.         OOSItem.Status = "Notify customer it's back in stock";
  6.     }
  7. }

When I update Add_Products with the stock availability information as above, the script gets executed successfully and the record in the notify form gets updated.

However, the script in the notify form does not get executed. I have put the following script in both the On Update for the field and also on update->on success:

  1. //Notify customer it's back in stock and send URL to reorder.
  2. if (input.Status  =  "Notify customer it's back in stock")
  3. {
  4.     sendmail
  5.     (
  6.         To       :  input.Email_Address 
  7.         From     :  zoho.adminuserid 
  8.         Subject  :  input.Product_Name + " back in stock" 
  9.         Message  :  "Dear&nbsp;" + input.Name + ",<br />\n<br />\nGreat news! Recently, you asked for us to notify you when&nbsp;" + input.Product_Name + " came back in stock.<br />\n<br />\nThe item is back in stock and can be ordered by clicking the following URL:<br />\n<br />\n" + "http://www.mylocalchemist.com/search.php?search_query=" + input.Product_Code_SKU + "&x=0&y=0" + "<br />\n<br />\nThanks in advance for your order!<br />\n<br />\nBest Wishes,<br />\n<br />\nMy Local Chemist<br type=\"_moz\" />" 
  10.     )
  11. }
  12. if (input.Status  =  "Notify customer it's been discontinued")
  13. {
  14.     sendmail
  15.     (
  16.         To       :  input.Email_Address 
  17.         From     :  zoho.adminuserid 
  18.         Subject  :  input.Product_Name + " has been discontinued" 
  19.         Message  :  "Dear&nbsp;" + input.Name + ",<br>\n<br>\nWe are very sorry to inform you that&nbsp;" + input.Product_Name + " has been discontinued by the manufacturer.&nbsp;<br>\n<br>\nThere may be alternatives to this product available. Please do not hesitate to email&nbsp;<a href=\"mailto:support@mylocalchemist.com?subject=Help%20choosing%20an%20alternative%20product\">support@mylocalchemist.com</a>.<br>\n<br>\nBest Wishes,<br>\n<br>\nMy Local Chemist<br type=\"_moz\">" 
  20.     )
  21. }

Is there something that I am missing out? I don't want to have to put the script in the Add_Products form if possible as I think that it will get complicated to maintain. I prefer having a bit of separation.