Subform loop not listing all records
Hi,
We have a script that should transfer subform records from one module to another subform in another module, but it is only pulling the last record and looping it in the other module.
Please see script below and advise on how we can modify it to pull in and transfer all subform records.
- Deal = zoho.crm.getRecordById("Deals",DealID);
- //info Deal;
- //Deal subform data
- subform = Deal.get("Credit_References");
- data = Map();
- formlist = List();
- //formlist.add(data);
- for each subRow in subform
- {
- data.put("Company_Name",subRow.get("Name_of_Supplier"));
- data.put("Location",subRow.get("Location"));
- data.put("First_Name",subRow.get("First_Name"));
- data.put("Email_1",subRow.get("Credit_Reference_Email"));
- data.put("Last_Name",subRow.get("Last_Name"));
- formlist.add({"Billing_Details":subRow.get("Credit_Reference")});
- //formlist.add(data);
- }
- //info formlist;
- //fetch Contract Mangagemnt Records associated to the opportunity
- contractRecords = zoho.crm.getRelatedRecords("Contracting","Deals",DealID);
- //info contractRecords;
- //This assumes one contract per opportunity - get the contract record id
- for each contractRecord in contractRecords
- {
- contractId = contractRecord.get("id");
- //info contractId;
- }
- //Note, this will overwrite the credit references from the opportunity
- // Update contract subform with opportunity subform data
- subformParam = Map();
- subformParam.put("Billing_Details",formlist);
- subformResponse = zoho.crm.updateRecord("Contract_Management",toLong(contractId),subformParam);
- info subformResponse;
Thanks,
Jason
Zoho Developer Community
Deliver unforgettable customer experiences
Deliver unforgettable customer experiences
New to Zoho Marketing Plus?
Everything you need to run your marketing
New to Zoho Marketing Plus?
Everything you need to run your marketing
Zoho Desk Resources
-
Desk Community Learning Series
-
-
-
-
-
-
-
-
-
Sticky Posts
Kaizen #152 - Client Script Support for the new Canvas Record Forms
Hello everyone! Have you ever wanted to trigger actions on click of a canvas button, icon, or text mandatory forms in Create/Edit and Clone Pages? Have you ever wanted to control how elements behave on the new Canvas Record Forms? This can be achieved
Extension pointers for integrating Zoho CRM with Zoho products #8: Upload and manage Zoho Workdrive folders and files from within Zoho CRM
Keeping records on your customers and business prospects is essential for tracking data, conducting follow-ups, and running a business smoothly. When you use two separate applications, and store relevant data in each, checking and tracking data becomes
Kaizen #142: How to Navigate to Another Page in Zoho CRM using Client Script
Hello everyone! Welcome back to another exciting Kaizen post. In this post, let us see how you can you navigate to different Pages using Client Script. In this Kaizen post, Need to Navigate to different Pages Client Script ZDKs related to navigation A.
Extension pointers #13: Handle cases with personalized solutions using custom actions
In our last post, we detailed the steps involved in creating a custom action and the workflow from the developer and end user's side. Now let's look at a working example of how we can create a custom action and implement it in a Zoho CRM account to make
Extension pointers - Simple yet significant pointers #13: On change of field value for CRM variables
CRM variables provide global access to a variable across an entire extension. They also help in the storage of user-specific data provided by the user at the time of installation, which can later be fetched to perform data functionalities. Additionally,
Zoho TeamInbox Resources
Zoho DataPrep Resources
Zoho CRM Plus Resources
Zoho Books Resources
Zoho Subscriptions Resources
Zoho Projects Resources
Zoho Sprints Resources
Qntrl Resources
Zoho Creator Resources
Zoho WorkDrive Resources
Zoho Campaigns Resources
Zoho CRM Resources
Zoho Show Resources
Writer Get Started. Write Away!
Writer is a powerful online word processor, designed for collaborative work.