Function

Function

I have a workflow made when a quote is edited the quote number will be copied to a text field Quote_number_ref in the deal that it is associated with. This is the function, it says successful in view usage but Deal field is never populated.  Any ideas?  
  1. // Fetch the Quote's details using the Quote ID
  2. quoteId = input.quoteId;
  3. quoteDetails = zoho.crm.getRecordById("Quotes",quoteId);
  4. // Get the Quote Number and associated Deal ID
  5. quoteNumber = quoteDetails.get("Quote_Number");
  6. // Replace with your actual Quote Number field API name
  7. dealId = quoteDetails.get("Deal_Name.id");
  8. // Replace "Deal_Name" with the actual API name of the lookup field that links the Quote to a Deal
  9. // If there's an associated Deal
  10. if(dealId != null)
  11. {
  12. // Create a map to store the Deal update data
  13. dealData = Map();
  14. dealData.put("Quote_Number_Ref",quoteNumber);
  15. // Replace "Quote_Number" with the actual API name of the custom field in the Deals module where you want to store the Quote Number
  16. // Update the Deal record with the Quote Number
  17. updateDeal = zoho.crm.updateRecord("Deals",dealId,dealData);
  18. }
  19. }