how to validate empty data in transform map?

jobin1
Tera Expert

Hi All,

 

I need to validate below excel data while doing transform load (before loading to table)

Validation should be like if the bae64 data is empty then it should not allow to load data.

find_real_file.png

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@jobin 

you can use onbefore transform script

(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {

	// Add your code here
	if(source.u_base64_data.nil())
		ignore = true;

})(source, map, log, target);

Regards
Ankur

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

View solution in original post

20 REPLIES 20

So what is not working?

if you are using onBefore then it should set the staging table field with the error message

Regards
Ankur

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

@Ankur Bawiskar So the code which I posted is corrected you're telling?

Regards,

Jobin

Hi,

your code is already correct.

is it not working?

are you using correct field name for import set?

regards
Ankur

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

Yes its  correct. I have passed empty bae64 data in excel but it created new record and "error reason" also not updated. Please find the screenshots.

 

find_real_file.png

 

find_real_file.png

Hi,

inside each if statement you should be adding ignore=true;

Regards
Ankur

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