The CreatorCon Call for Content is officially open! Get started here.

How to Skip the Update of a field in Transform Map or Run its Field-mapping Script

Brizky
Giga Expert

Hello, everyone.  

 

I have a phone number field in my Transform map that needs one of two things to happen.

 

  1. If the source Phone number is a specific value (i.e. '555-55-5555') then we don't update the target phone number.
  2. If the source phone number is anything else, run the script for that mapped field that will modify that phone number before updating the target phone number.

I've seen this post, Transform map script ignore particular field updat... - ServiceNow Community, which isn't exactly what my situation is.  And I looked up the precedence order for how scripts run during a transform.  But I can't figure out quite how to make this work for my situation.

Could someone point me in the right direction?

1 ACCEPTED SOLUTION

Alka_Chaudhary
Mega Sage
Mega Sage

Hello @Brizky ,

You can remove the field map for phone number and write on before transform script.

You can try the below script:-

if(source.phone_number != "555-555-5555") {
     target.phone_number = source.phone_number; 
}

Please Mark my answers Helpful & Accepted if I have answered your questions.

Thanks,

Alka

View solution in original post

8 REPLIES 8

Alka_Chaudhary
Mega Sage
Mega Sage

Hello @Brizky ,

You can remove the field map for phone number and write on before transform script.

You can try the below script:-

if(source.phone_number != "555-555-5555") {
     target.phone_number = source.phone_number; 
}

Please Mark my answers Helpful & Accepted if I have answered your questions.

Thanks,

Alka

And I can leave all of my other field mappings as is and they'll all still be processed?

@Brizky Yes

I think this may be the way to go.  Thank you.