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
Access your files securely from anywhere
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
-
-
-
-
-
-
-
-
-
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 Campaigns Resources
Zoho CRM Resources
Zoho Show Resources
Writer Get Started. Write Away!
Writer is a powerful online word processor, designed for collaborative work.