Help needed on transform map

Mansi roy
Tera Contributor

Hello All,

 

I have just started working on transform map. I need help on below requirement how to achieve.

 

I have field on source table u_company. In target table there is field company. I need to map through script.

 

Incoming values have to be matched with Values in Table Companies(core_company).

Incoming values will be Microsoft and Lenovo. These two companies exist in core_Company table.

 

How to map through script can anyone please help me.

 

Regards,

Mansi

3 REPLIES 3

Chaitanya ILCR
Mega Patron

Hi @Mansi roy 

answer = (function transformEntry(source) {

    var gr = new GlideRecord('core_company');
    if (gr.get('name', source.u_company /*put your source field name here*/ )) {
        return gr.getValue('sys_id');
    }
    return "";

})(source);

ChaitanyaILCR_0-1744706956055.png

 

in the field you can use the shared script

 

 

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya

Ankur Bawiskar
Tera Patron
Tera Patron

@Mansi roy 

Since you said you will get name of company in source table

simply in field map set "Referenced value field name" field as name and no scripting required

 

AnkurBawiskar_0-1744707241671.png

 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@Mansi roy 

Thank you for marking my response as helpful.

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader