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.
I have tried to just use the "text" version but get the same thing.
Example comment that is failing:
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.
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
@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).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.