Commodore Commodore
Commodore
675 views

How to test for existence of string in a field using Expression Language

Jump to solution

Good day everyone.

I was trying to add a business rule with the following logic:

If the request title contains the words critical or down, then raise an incident.

I tried using the following code but it doesn't work:

${contain(entity.DisplayLabel, 'critical') || contain(entity.DisplayLabel, 'down')} Set ServiceImpact to true

I tried this too but doesn't work:

$match_pattern(entity.DisplayLabel, '*critical*') Set ServiceImpact to true

Can someone please show me how it's done.

When I try just a simple $entity.DisplayLabel == 'critical' Set erviceImpact to true, it works. 

But I need to test for the existence of string.

Thanks and regards.

0 Likes
1 Solution

Accepted Solutions
Micro Focus Expert
Micro Focus Expert

Hello,

The match_pattern rule should work, I tested your rule.

The "contains" will not work, it applies to collections.

Best regards,

Brindusa

View solution in original post

0 Likes
2 Replies
Micro Focus Expert
Micro Focus Expert

Hello,

The match_pattern rule should work, I tested your rule.

The "contains" will not work, it applies to collections.

Best regards,

Brindusa

View solution in original post

0 Likes
Commodore Commodore
Commodore

Thanks Brindusa.  I went back to my code and try changing the synrax and the below works.  Thanks for your tip.

Capture.JPG

 

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.