Fail transform map if the reference field data does not exist

Manikandan2
Kilo Expert

Hi,

I have 2 tables, Service Offering and company. Company table has a reference field referencing Service Offering table. When i do a data import to the company table, if the serivce offering does not exist in the service offering table then it creates an entry in the Service offering table. The requirement is if the Service offering value does not exist in the Service Offering table then the transform map should fail and the data import should not happen to company table.

How do i achieve this?

1 ACCEPTED SOLUTION

Harish Murikina
Tera Guru

Hi Manikandan,

Open the field map and set action reject.

find_real_file.png

2. If you would like to ignore entire row , write onBefore transform script .

var serviceOffering = source.getValue("please give service offering var name");

if (action == ïnsert && JSUtil.notNil(serviceOffering)) {

var serviceOfferinGr = new GlideRecord("ServiceOffering table name");

serviceOfferinGr.addQuery("Please give variable name which you would like to compare from service offering table", serviceOffering);

serviceOfferinGr.setLimit(1);

serviceOfferinGr.query();

if (!serviceOfferinGr.next()) {

ignore = true;

}

}

 

 

Regards,

Harish Murikinati.

View solution in original post

15 REPLIES 15

Screenshot 2024-01-05 093308.pngi did this but still its not working . can anyone help me out