Create records from custom module to custom module with subform on both module by using function

Create records from custom module to custom module with subform on both module by using function

Hi,

I had created two custom module, and created a function to be trigger when condition meet.
The function will copy the records from module A to module B , along with subform details.

However, I had encounter error:
Failed to execute function Mismatch of data type expression. Expected List but found String Line Number:14

Please find details and script as below:
Custom Module A: Robot_RMA
Subform name : Subform_2
Lookup Field : SN_ID, Customer, Replacement_SN_ID
Single Line Field : Name, FSR_No
Lookup Field on subform : Component_SN_ID, Replace_Comp_SN_ID

Custom Module B: Robot3
Subform name : Component_History
Lookup Field : SN, Customer, RMA, Replacement_SN_ID
Single Line Field : FSR_No
Lookup Field on subform : Defect_Comp_ID, Swap_Comp_ID

rmaInfo = zoho.crm.getRecordById("Robot_RMA",rmaId.toLong());
//info rmaInfo;
mp = Map();
mp.put("SN",ifnull(rmaInfo.get("SN_ID"),""));
mp.put("Customer",ifnull(rmaInfo.get("Customer"),""));
mp.put("RMA",ifnull(rmaInfo.get("Name"),""));
mp.put("Replacement_SN_ID",ifnull(rmaInfo.get("Replacement_SN_ID"),""));
mp.put("FSR",ifnull(rmaInfo.get("FSR_No"),""));
sub_forms = List();
//info subinfo;
subinfo = ifnull(rmaInfo.get("Subform_2"),"");
for each  rec in subinfo
{
componentDefectSN = ifnull(rec.get("Component_SN_ID"),"").get("id");
if(componentDefectSN != "")
{
subform = Map();
subform.put("Defect_Comp_ID",rec.get("Component_SN_ID").get("id"));
subform.put("Swap_Comp_ID",rec.get("Replace_Comp_SN_ID").get("id"));
sub_forms.add(subform);
//info sub_forms;
}
}
mp.put("Subform_2",sub_forms);
create = zoho.crm.createRecord("Robot3",mp);
info create;