Transform Map script to set value

matt_a
Kilo Guru

I have an existing transform from a server, populating location data.

I have added a new field u_created_by_workday which is a Boolean field.

I would like the transform to set this value to true if the record exists in the source. If it doesn't then to ignore.

I'm thinking I might need to do this via a before script? Or is doing it via a field map script ok?

Could someone please help with the script and which method to use?

Many thanks in advance 

1 ACCEPTED SOLUTION

Vasantharajan N
Giga Sage
Giga Sage

Please use "Source Script" with the logic which return true if the location existsin table cmn_location else return false. (Please make change as per your need/requirement)

var tableGr = new GlideRecord('cmn_location');
if (tableGr.get('name', source. < fieldname > )) {
return true;
}
return false;

For your reference

find_real_file.png


Thanks & Regards,
Vasanth

View solution in original post

2 REPLIES 2

Vasantharajan N
Giga Sage
Giga Sage

Please use "Source Script" with the logic which return true if the location existsin table cmn_location else return false. (Please make change as per your need/requirement)

var tableGr = new GlideRecord('cmn_location');
if (tableGr.get('name', source. < fieldname > )) {
return true;
}
return false;

For your reference

find_real_file.png


Thanks & Regards,
Vasanth

Perfect, thanks for your help