Hoping someone can help me with a Smart Values question.
I have two variables defined in my automation rule:
var X: "e5a9e2ce-3d34-47b2-bc03-078197c2a7cf", "c1466970-6196-4741-9425-237c3466b37d", "dc1603c3-6941-4003-a660-1f522f8d4b5f", "ee49ea67-3549-4733-a3d3-98b24c35f852"
var Y: "c1466970-6196-4741-9425-237c3466b37d", "ee49ea67-3549-4733-a3d3-98b24c35f852"
What I want to do is remove any values from var X that also exist in var Y.
Expected result:
var Z: "e5a9e2ce-3d34-47b2-bc03-078197c2a7cf", "dc1603c3-6941-4003-a660-1f522f8d4b5f"
Is there a way to do this using Smart Values in Jira automation or any other way to do it?
Hi @Mafe Ortega
There are a couple of ways to do this; let's try the one using a regular expression and the replaceAll() function. First the answer and then how it works:
({{varY.remove("\"").split(", ").join("|")}})
{{varX.remove("\"").split(", ").replaceAll(varRegEx, "").match("(.++)").asJsonString}}
How that works...
The other way do do this is with a regular expression to directly remove the values (using negative lookahead). I have observed inconsistencies using this with rules, so I recommend sticking with replaceAll() rather than trying to do this with a single match() expression.
Kind regards,
Bill
Hi @Mafe Ortega
Just following up to check if this answered your question. If so, please consider marking this one as "answered". That will help others with a similar need find solutions faster. If not, please let the community know what help you need with the rule changes.
Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.