Automation - Comments and Advanced compare - Error while parsing additional fields. Not valid JSON.
Asked by Andy:

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](https://community.atlassian.com/t5/image/serverpage/image-id/284920iDB0EAC2EC1234043/image-size/large?v=v2&px=999 "2.jpg")

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

![1.jpg](https://community.atlassian.com/t5/image/serverpage/image-id/284922iFD3BED3C076344FE/image-size/large?v=v2&px=999 "1.jpg")

Example comment that is failing:

![3.jpg](https://community.atlassian.com/t5/image/serverpage/image-id/284921iDAD96013D648D43A/image-size/large?v=v2&px=999 "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.


Answers:
author: Bill Sheboy
body: Hi [@Andy](/t5/user/viewprofilepage/user-id/4412981)

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

comments: author: Andy
body: [@Bill Sheboy](/t5/user/viewprofilepage/user-id/1685313) 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](https://community.atlassian.com/t5/image/serverpage/image-id/285274i4C4C4D85668C3EB5/image-size/large?v=v2&px=999 "2.png")

![1.png](https://community.atlassian.com/t5/image/serverpage/image-id/285273i2A3E959514EDDF36/image-size/large?v=v2&px=999 "1.png")


author: Bill Sheboy
body: 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.


author: Bill Sheboy
body: Hi [@Andy](/t5/user/viewprofilepage/user-id/4412981)

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!