Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Ignore field value in transform map if empty

Khanna Ji
Tera Guru

Hi,

I want to ignore the field update if its coming as empty instead of rejecting the entire row. Is this possible?

For example if state is already existing for a user in user table and if a new value is coming from staging table in which state is blank then that field should not be updated and rest all should get updated.

Is this possible?

7 REPLIES 7

Just write a script for that particular transform map field stating if str = '' ; return false;

i see few other options. But you will have to check for all incoming empty values.

  if(trim(source.field_1)==''){

        }

1. Run Script on Transform Map 

2. Field mapping script

3. OnBefore Transform Script

 

Hope this helps

 

Thanks,

Harshinya  

    

 

 

Paul Kunze
Tera Guru

Hi, there is a nice and easy way to only do this for one specific field without changing the configuration.

In your Field Map set "Use source script" to true and add this code:

	if(source.yourfieldname === ''){ // new value is empty
		return target.yourfieldname; // ignore (use existing target value)
	} else {
		return source.yourfieldname; // otherwise update
	}