Deluge script executes but doesn't update record?

Deluge script executes but doesn't update record?

I have worked/researched all day trying to get this to work but the record doesn't update. The script executes successfully. I could use some insight and direction.  Maybe I'm not approaching this right or some part of my code is incorrect?

Here are details and script

  1. Building a workflow that has a custom instant action function ( I will add a 10 min delay on it after successful transfer of data is achieved).
  2. The goal is to populate a lookup field named Sales_Order in a custom module named Patients upon new patient record creation that associates the Patient record with the correct Sales Order
  3. Both Modules have identical order number fields and they both contain the same number. So the script uses that criteria to search the Sales_Orders records to find the match
  4. If there is a match (always should be) then copy the "Subject" field from the matching Sales Order module record and put it in the matching Patient module lookup field Sales_Order which creates the correct association
  5. I already created the argument mapping "patient_record_id = Patients - Patient Id"

  1. // Get the Order_Number field from the Patients module
  2. patient_record = zoho.crm.getRecordById("Patients", patient_record_id);
  3. order_number = patient_record.get("Order_Number");

  4. // Search the Sales_Order module for a matching Order_Number
  5. sales_orders = zoho.crm.searchRecords("Sales_Orders", "Order_Number:equals:" + order_number);

  6. // If a match is found, get the Subject field of the matching Sales_Order record
  7. if(sales_orders.size() > 0) {
  8.     sales_order_record = sales_orders.get(0);
  9.     sales_order_subject = sales_order_record.get("Subject");

  10.     // Update the Sales_Order field of the Patients module with the matching Sales_Order subject
  11.     update_data = Map();
  12.     update_data.put("Sales_Order", sales_order_subject);
  13.     update_response = zoho.crm.updateRecord("Patients", patient_record_id.toLong(), update_data);
  14. }