• I agree with the solution but i would recommend another approach which is simpler and doesn't require any script component.

    You can use conditional split to split the source data based on record type and have multiple destination for each record type.