Automation - Comments and Advanced compare - Error while parsing additional fields. Not valid JSON.

Andy
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 6, 2023

I have setup an automation in which where the comment starts with "UPDATE:" it should populate another field with the comment value.

This seems to work when the comment is just one line of text, once it's two lines or includes an @ tag for someone it starts to fall over with.

Error while parsing additional fields. Not valid JSON.

2.jpg

I have tried to just use the "text" version but get the same thing.

1.jpg

Example comment that is failing:

3.jpg

I have tried to use the best of my GoogleFu but have failed to be able to work out a fix for this. 

Any advice greatly appricated. 

1 answer

1 accepted

0 votes
Answer accepted
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 6, 2023

Hi @Andy 

For a question like this, it can help to also post images of your complete rule and the audit log details.  Those will provide context for the symptom.  Thanks!

Back to your question...

Where are you seeing that error in the audit log details?  Is it for the advanced compare condition or something else?

If it is for the advanced compare, I wonder if it is building a regular expression behind the scenes and so failing on a match.  You could try brute-forcing the comparison by splitting and explicitly controlling the check on the first line of text:

{{comment.body.text.split("\n").first.toLowerCase().startsWith("update:")}}

And then check if that equals true.

Kind regards,
Bill

Andy
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 9, 2023

@Bill Sheboy thanks for your reply. Is below what you were looking for?

I didn't quite get what you meant with the regex, i tried a few things and the below gave me the same result (where multiple lines, it falls over).

 

2.png

1.png

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 9, 2023

Okay, let's back up a bit...I tested around this symptom and the comment field will not split() as I expected.  (No idea why...although the field editor may be different for comments.)

I did test this what you originally had and it worked for me!

So here is my hypothesis: your rule got "glitched" from too many edit/publish cycles, which can happen some times.  (This seems to happen in some way where the rule's JSON gets corrupted, which could also explain the error message you are seeing.)

We can test this by returning your rule to what you originally posted, publishing, AND then disable the rule. Wait a second, and re-enable it and test again.

If it again does not work, disable your current rule, re-create it from scratch, and test again.

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 4, 2023

Hi @Andy 

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!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events