Transform script to check string contains
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2024 03:09 AM
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2024 04:23 AM
@Nisha30 Instead of Target you should use target
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2024 05:39 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2024 09:00 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2024 03:33 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2024 05:45 AM
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....