JIRA Automation issue

Hello, I was told to reach out to the Developer Community from Atlassian Support in hopes to get some help with my automation we have been working on. Currently, the automation seems to work when all three fields I am updating have a value. For the other times, it seems like it is hit or miss. I am hoping to get some help tweaking what I currently have to work in all situations.

I even tried removing the field conditions and still no luck.

Within the main part of the rule is this:

Here is the regex to make it easier:

{{DescFormat.substringBetween(“myColorado Username|”,"|\n|OS Version")}} - MyCo UserId {{DescFormat.substringBetween(“OS Version|”,"|\n|Phone Model")}} OS Version {{DescFormat.substringBetween(“Phone Model|”,"|\n|Feedback")}} Phone Model

In a nutshell we are using the DescFormat field to get all the details of the issue formatted; then the automation will update fields (if all three are present, or if 2/3 are there, some will get updated, depending on the order)

I am thinking for this issue Log in with Atlassian account
since the OS Version wasn’t there the myColorado ID didn’t have anything to look between and pull from and the same for the OS Version so only the Phone Model pulled in. Any ideas how I can work around that?

I was not able to upload more than one image :frowning:

Welcome to the Atlassian Developer Community, @JayJuanJones !

As for your question, let me unpack this a bit. This is my current understanding of your scenario, please correct me if I got something incorrect:

  1. In your DescFormat field, in order for you to get the values and set the necessary fields, you expect something like
|myColorado Username|Ian|
|OS Version|Windows 95|
|Phone Model|Nokia 3210|
|Feedback|awesome feedback|
  1. When all fields are present in your pipe-delimited string, then it works fine.
  2. The problem you mentioned is when one of the tokens is missing, like this for example
|myColorado Username|Ian|
|Phone Model|Nokia 3210|
|Feedback|cool|

which yields an empty field for the smart value {{DescFormat.substringBetween(“myColorado Username|”,"|\n|OS Version")}}.

If my understanding of your scenario is correct, I believe this is the expected behavior since the closing string |\n|OS Version does not exist in your input string (which is DescFormat). You can try using | as the 2nd parameter so that is not dependent on OS Version. This means your regex will become {{DescFormat.substringBetween(“myColorado Username|”,"|")}}. This way you can handle missing tokens.

If my assumption of the input string (or the whole scenario) is incorrect, kindly add a sample working and erroneous input string here so that the community can help you out.

Cheers,
Ian

Thank you for the welcome @iragudo!

yes, I think you understood that perfectly! the only issue I am running into now is that maybe my assumption is incorrect. When I did what you said and used | as the 2nd parameter so that is not dependent on OS Version, I am still only getting Phone Model returned. Here is my DescFormat if that helps:

Your request has been sent from [t***.s***@gmail.com|mailto:t***.s***@gmail.com] user name . Here are the user provided errors |Name|S*** l*** | |Email Address|[t***.s***@gmail.com|mailto:t***.s***@gmail.com]| |Phone Number|xxx8814| |myColorado Username|S***| |Phone Model|iPhone | |Feedback or Error Being Reported|I can’t log in because it keeps sending verification to my number, but I recently changed numbers so I’m not receiving them and it looks like that the preferred method I chose. How can I get back in? | {color:#444} Sent via{color} [{color:#444}Google Form Notifications{color}|https://urldefense.proofpoint.com/v2/url?u=https-3A__gsuite.google.com_marketplace_app_email-5Fnotifications-5Ffor-5Fgoogle-5Fforms_984866591130&d=DwMFaQ&c=sdnEM9SRGFuMt5z5w3AhsPNahmNicq64TgF1JwNR0cs&r=Y4V_zMJBcV2DSSfYRnv6MDh3NaQhkArHyM1No5MQg3w&m=pUfiacsCk5SfWc1up2R-W3Fsv0bLpJp7TbTWFWmiAEvzsQki5FWXNc_zjOKH_KyT&s=4jOxM6TV_QhIaymDl62CcaxCikpOobz1kfNSHk_NnbY&e=]{color:#444}{color}

Hi @JayJuanJones ,

I edited your previous message to remove the personal information in the DescFormat sample request.

I tried to replicate your issue using the sample request you provided and I am getting the proper response when parsing the username and phone model

.

Here is the automation rule setup I used:

Cheers,
Ian

EDIT:

I tried copy-pasting this string directly and I can no longer set my username field.

{{issue.DescFormat.substringBetween(“myColorado Username|”,"|")}}

I noticed the different double quotes being used in the 1st param and changed it to " (the neutral/vertical one) and my automation works as expected. Is this something you can try?

that seems to have fixed it!!! thank you so much! you’re awesome!

1 Like