Hello Everyone! 🎉
The Problem:
When creating a new Deal, it’s straightforward to pass the Lead ID to the Deal via a custom field, but there’s no native way to automatically link the new Deal’s ID back to the originating Lead.
The Solution:
I worked around this limitation by using a short Deluge script in a workflow that triggers after the creation of a new Deal. Here’s how it works:
Lead_ID_before_conversion) with the Lead’s ID.Deluge Script:
void automation.FetchDealIDToMotherLead(int recordId)// Fetch the Deal record based on the passed ID in JSON format dealInfo = zoho.crm.getRecordById("Deals", recordId, "json"); // Retrieve the Lead ID from the Lead_ID_before_conversion field leadIdJson = dealInfo.get("Lead_ID_before_conversion"); if(leadIdJson != null) { // Extract the ID directly from the JSON object leadId = leadIdJson.get("id"); // Update the Lead by setting the Deal_ID_after_conversion field to the current Deal ID leadMap = Map(); leadMap.put("Deal_ID_after_conversion", recordId); updateLead = zoho.crm.updateRecord("Leads", leadId, leadMap); } }
Steps to Implement:
Lead_ID_before_conversion is populated with the originating Lead’s ID.With this simple solution, you can effectively connect Leads to their Deals and streamline your data management! 😊
If you have any questions or need more details, feel free to ask! 💬