my requirement is we have automated jira tikcets where automation fetches using API and work on it if Jira ticket summary is like below (fetching using API in string variable_
summary - Please activate the Jira license & confluence for below user
if summary contans any word(one or more) from this list - Workflows, Screens, Boards, Dashboards, Fields, Permissions, Notifications, Priorities, Reports/Gadgets, Big Picture, EazyBI, Exalate, GIT, Tempo TimeSheets, Time to SLA, X-Ray
one more thing users may write above words in capital as well so tell me accordingly
then i need to send notification that i will manage.
but how can i check if summary contains any word from above list
is there any LINQ query?
Yes, you can use a LINQ - it’s going to be a long one lol but it can work.
I would first create an array that holds all of those keywords that you mentioned, then in an assign you create a Boolean named “containsKeyword” as an example. And finally you can do something like this in an assign:
Then you can simply use an IF condition to check if containsKeyword = True
The best thing is to rather create that array as a String Asset in Orchestrator (and then split it by a character into an array) - because you can modify it at any point without making a code change. Safest approach.
You can also use regular expressions to do it. Pretty much a similar concept except you’re matching the word in an expression rather than a LINQ:
Store Workflows, Screens, Boards, Dashboards, Fields, Permissions, Notifications, Priorities, Reports/Gadgets, Big Picture, EazyBI, Exalate, GIT, Tempo TimeSheets, Time to SLA, X-Ray in asset as a text.
Use Get Asset to read the particular asset in a variable say strSummaryWords.
After that use the below syntax to change it to list variable. lstSmmaryWords = strSummaryWords.Split(","c).Select(Function(w) w.Trim()).ToList() summary = Output of API
After use the below syntax in If:
If lstSmmaryWords.Any(Function(word) summary.IndexOf(word, StringComparison.OrdinalIgnoreCase) >= 0)
Then
Send notification I will manage
Else
Log Message
End If
i need to store this words in config file because in case if any word i need to add then i can directlyt add in config file no need to chnage in script
but when i am assigning config variable to array string variable it is showing cannot assign system.char to system.string