I think what I want to point out here is the entry in the Component Ci field is not the sys_id of the configuration item but instead the sys_id of the relationship record.

I would like the script to look inside the relationship record at the CHILD field and then use this to create the relationship record and populate the ci_item field.

 

I hope this all makes sense