Transform script to check string contains

Nisha30
Kilo Sage

Hi Community,

I have below code OnAfter which is not working. This is to if the string contains the intended string if yes then need to set a Target field with specific value . This is via uploading via excel. Any suggestions please.

 

if(source.u_sprint.toString().indexOf('Sprint 1')>-1)

Target.sprint = "P SP 1";

if(source.u_sprint.toString().indexOf('Sprint 2')>-1)

Target.sprint = "P SP 2";

if(source.u_sprint.toString().indexOf('Sprint 3')>-1)

Target.sprint = "P SP 3";

 

Thanks

 

9 REPLIES 9

@Nisha30 Instead of Target you should use target

yeah tried that but the value is not updating in the field. Something to do with Reference field ?

 not sure as field = Sprint is a reference field , i tried using sys_id as well but seems not working.

IMG_20240527_133417189.jpg

Hi @Nisha30 ,

 

Navigate to [sys_import_set] table and open the ISET record for your import set table and in the 'import set row' related list open the record and check whether the 'u_sprint' field is getting populated or not.

If it is getting populated then your script should work in 'onAfter' script.

 

Please mark this response as correct or helpful if it assisted you with your question.

----------------------------------------------------------------
Mark this as Helpful / Accept the Solution if this helps.

Mohan Mallapu
Kilo Sage

Hi @Nisha30 

In your script there is an error with target.

In the transform maps the "target" is the correct parameter but you have mentioned are captical "T" -> Target that will not work.

If my answer solved your issue, please mark my answer as Correct & 👍Helpful based on the Impact.

Sohail Khilji
Kilo Patron
Kilo Patron

dont use capital T in keyword 'target'

 

use > target.u_sprint not Target.u_sprint


☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....

LinkedIn - Lets Connect