I think I have an issue with my smart value. I want it to grab the email in the last comment of a newly created issue. I tried with both "" and no "" around the regex but the rule still errors. Am I going about this the wrong way or do I have an issue with this smart value?
{{issue.comments.last.body.match("^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$")}}
Thanks for the help!
Smart value should be: {{issue.comments.last.body.substringAfter("Email address: ")}}
Hi @rpatrick
I do not believe it is possible to add a comment when creating a work item. It must be created first and then comments can be added. Where were you able to create one and add comments at the same time?
Next, and assuming the comment is added later, you appear to be extracting zero-to-many email address values, and then using them in a branch. This will potentially lead to timing and collision problems when there are multiple values. What do you expect to happen?
Finally, I believe there is special markup used for an email address value in comments, and other rich text fields. And so each address is present twice. This can be confirmed by writing an example value to the audit log, and then mitigated by adding the distinct function after the match.
Kind regards,
Bill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Bill,
The comment is added automatically upon creation because the ticket is triggered from the submission of a form - though I did just figure out that I could use a different string manipulator which seemed to do the trick for populating the custom User Picker field 'Hiring Manager' as seen in the rule screenshot.
This was what worked:
{{issue.comments.last.body.substringAfter("Email address: ")}}
Thanks for your response!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for that information, @rpatrick
In that case, I recommend adding the Re-fetch Work Item Data action immediately after that trigger (and before any other steps) to prevent timing problems.
The reason is behind the scenes, the create definitely happens before the comment is added, leading to a short delay. Thus the rule could start before the comment is available to the rule. And because this is timing-related, it will work (or not work) intermittently without the re-fetch.
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.