The CreatorCon Call for Content is officially open! Get started here.

Why all data have not been loaded from transform map?

Ankita Kolhe
Tera Contributor

Hi Community,

 

It seems like there is some issue with transform map field map script:-

 

answer = (function transformEntry(source) {

    // Add your code here
    var groupings=[];
if(source.u_iogc_grouping_1!=''){
    var groupSysId1 = getEntityUpdateGroupSysId(source.u_iogc_grouping_1);
    groupings.push(groupSysId1);

}

if(source.u_iogc_grouping_2!=''){
    var groupSysId2 = getEntityUpdateGroupSysId(source.u_iogc_grouping_2);
    groupings.push(groupSysId2);

}

if(source.u_iogc_grouping_3!=''){
    var groupSysId3 = getEntityUpdateGroupSysId(source.u_iogc_grouping_3);
    groupings.push(groupSysId3);

}

if(source.u_iogc_grouping_4!=''){
    var groupSysId4 = getEntityUpdateGroupSysId(source.u_iogc_grouping_4);
    groupings.push(groupSysId4);

}

if(source.u_iogc_grouping_5!=''){
    var groupSysId5 = getEntityUpdateGroupSysId(source.u_iogc_grouping_5);
    groupings.push(groupSysId5);

}



function getEntityUpdateGroupSysId(name) {
        var gr = new GlideRecord('x_kpm79_kpmgi_iogc_em_iogc_grouping');
        gr.addQuery('choice_value', name);
        gr.query();
        if (gr.next()) {
            return gr.sys_id.toString();
        }
    }

    return groupings.join(','); // return the value to be put into the target field

})(source);
 
 
I'm trying to load data to IOGC Grouping field(glide list type)  but all data is not getting loaded.
 
excel data:-
AnkitaKolhe_0-1726114535320.png

 

data in instance:-

AnkitaKolhe_1-1726114716349.png

 

Could someone please help with the issue in code above?

 

Thanks,

Ankita

 

1 REPLY 1

dhanrajb
Tera Guru

Hi Ankita,

if(groupings.length == 5){
    return groupings.join(',');
}

Just have this condition for testing before it returns.

 

Regards,

Dhanraj.