Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to ignore case sensitivity in flow designer

Swetham
Tera Contributor

Hi all,

 

My requirement is as follows,

I have a set of 10 keywords.( eg, Password)

I have to check if any of the keywords is present in my interaction's short description and if so i've to create an incident.

 

This has to be done in flow designer and this must be case insensitive.

 

Could you please help me with inputs?

Thanks in advance!

5 REPLIES 5

ahmedkhan
Tera Contributor

Others have already mentioned using the flow designer data pill.
I've added a complete solution.
Works like this:
There is a flow, and an action to check the string match. The action can take any 2 string sets, comma separated also works, and returns true if there is a match. The flow calls the action. If there is match, it returns true.

I've attached the update set with the changes, should you need it. I'm also pasting the custom JS script used in the action below.

 

(function execute(inputs, outputs) {
  // Get the input string sets
  var firstSet = inputs.string1.toLowerCase();
  var secondSet = inputs.string2.toLowerCase();

  // Initialize the flag for intersection
  var intersection = false;

  // Split the comma-separated strings into arrays and trim each element
  var firstArray = firstSet.split(',');
  var secondArray = secondSet.split(',');

  // Loop through the arrays to find any intersection
  for (var i = 0; i < firstArray.length; i++) {
    for (var j = 0; j < secondArray.length; j++) {
      if (firstArray[i] === secondArray[j]) {
        intersection = true;
        break;
      }
    }
    if (intersection) {
      break;
    }
  }

  // Output the result
  outputs.intersection = intersection;

})(inputs, outputs);