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 03:20 AM
@Nisha30 Please update the script as follows and check if the change works.
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";
Hope this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2024 03:24 AM
Thanks for response not sure what is the difference in here with the existing code.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2024 03:33 AM
Hi @Nisha30
you use Target.sprint instead of target.sprint.
Thanks
dgarad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2024 08:46 AM
another issue is the value in the excel sheet for field 'sprint' is getting inserted as new record even though choice= ignore and the source.u_sprint gives the inserted record sys_id. thats wierd why it should give the insetted record sys_id and not the string from excel sheet.
any leads on this please
thanks