- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-02-2024 06:37 AM
Hello everyone,
@Ankur Bawiskar if you can please help on this.
I am trying to populate assignment group of catalog task based on RITM requested for location through flow designer.
The script is working fine with indexOf but this might not give correct results if required text e.g Noida or Chennai is at last or in middle position of location .
Below is the one that I used in script of assignment group of flow designer:
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-02-2024 07:08 AM
Its not complicated, it will work like contains search only.
Just use this
if (locations.toString().toLowerCase().indexOf("noida")>-1|| locations.toString().toLowerCase().indexOf("chennai")>-1 )
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-02-2024 07:42 AM
Ohk great then I will try this and confirm you soon. Thanks a lot for your help, I’ll update you by tomorrow if it works or not.
Thanks,
Harsha
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-02-2024 06:50 AM - edited 09-02-2024 06:52 AM
Hi,
The indexOf()
method returns -1 if the value is not found. So in your case as long as its more than -1 that means the string is present.
It should be as below
if (locations.indexOf("noida")>-1)
PS. indexOf method is case sensitive. So if you are not sure of the case then its better to convert the whole string to lower case before searching for the keyword.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-02-2024 07:05 AM
Hi Anurag,
Thanks for your response.
Is there a way to use location.Like Noida or location.contains Chennai? I tried with these but is not running.
I do not want to use indexOf since there are many constraints.
Please suggest an alternative for indexOf
Thanks,
Harsha
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-02-2024 07:08 AM
Its not complicated, it will work like contains search only.
Just use this
if (locations.toString().toLowerCase().indexOf("noida")>-1|| locations.toString().toLowerCase().indexOf("chennai")>-1 )
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-02-2024 07:14 AM
Ok I will try this but there is one more issue, locations are multiple so is there a way to fetch data dynamically in this flow designer script? Because I will have to mention all locations here one by one.