Hello, I'm using the new public forms and running into some issues since it doesn't give you the ability to map the submitters email to a custom field and instead adds it to a comment on the issue it creates when submitted.
I created JIRA automation to parse a comment that is created from a submitted form in order to extract the email and then use actions to update the custom field to track the email, and lastly send a confirmation email to the person acknowledging we received the request.
My issue is that the automation fails when submitting the form as it says to provide an email recipient. The automation extracts the email from the comment but during a form submission this seems to fail. If I repeat the comment manually after the issue is created the automation works perfectly.
I've done triggers when a field changes, and also when a work item is commented. I've done delays, refetch data, log actions but have not been able to get this working when submitting the public form. I hope someone has done something similar and can over some advice. Thank you!
The forms I'm using.
I'm using {{issue.comments.last.body.substringAfter("Email address: ")}} to extract the email from the comment. the comments are added to the issue like below
"This work item was created based on someone's response to a Jira form.
Hertz CRM | Form
Email address: john.doe@test.com"
I'm using {{issue.comments.last.body.substringBetween("mailto:", "]")}} to set the variable in the rule as I only want the basic email address (without this it was adding john.doe@test.com | mail to: john.doe@test.com)
Failure Log on form submission
Successful log when triggered directly in JIRA
Hello @Brian Martinez
You said you tried Re-fetch and Delay, but did you still have the Condition within the trigger when trying those?
Can you show us the rule structured with the Re-fetch or Delay, with the condition not in the trigger, and the audit log results?
Hi @Trudy Claspill, thanks for your response. Here is an example of me using Delay and re-fetch.
Here is the rule
Here is the audit
If I copy the original comment and re-enter it via the UI the rule works perfectly.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What are the details of the Create Variable action?
It seems like the variable is failing to get an actual value based on the later Log action you have.
Can you try moving putting a Re-fetch action or Delay action immediately after the trigger and before the IF component?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The create variable is using
{{issue.comments.last.body.substringBetween("mailto:", "]")}} as I want just the email from the {{issue.comments.last.body.substringAfter("Email address: ")}} extraction.
I tried putting the refetch before the IF statement by itself (no delay), delay by itself (no refetch), and Delay then refetch before the IF statement and get failures.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you for trying that suggestion @Brian Martinez .
I've done some testing of my own. I suspect that the failure when the form is submitted has to do with the fact that your substringBetween function is unable to find the "mailto:" and "]" delimiters when the comment is created by the form submission.
Can you add a Log actions immediately after the trigger to log the following information to the rule audit log?
I created a rule with a Work Item Commented trigger followed just by Log actions #1 and #2 above. I then created an issue by submitting a public form where I had entered my own email address.
Log action #1 rendered the following:
This work item was created based on someone's response to a Jira form. [https://x.atlassian.net/jira/software/c/projects/TCSC/form/88/builder|https://x.atlassian.net/jira/software/c/projects/TCSC/form/88/builder|smart-link] Email address: tclaspill@x.com
Log action #2 rendered the following:
tclaspill@x.com
Log action #3 rendered nothing.
If I manually copy the original comment in the UI and post it again then the output logged is different.
Log action #1 rendered the following:
This work item was created based on someone's response to a Jira form. [https://x.atlassian.net/jira/software/c/projects/TCSC/form/88/builder|https://x.atlassian.net/jira/software/c/projects/TCSC/form/88/builder|smart-link] Email address: [tclaspill@x.com|mailto:tclaspill@x.com]
Log action #2 rendered the following:
[tclaspill@x.com|mailto:tclaspill@x.com]
Log action #3 rendered the following:
tclaspill@x.com
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you so much for your help! You helped me uncover the issue. I was almost there with the log actions, but didn't take the extra step. I was testing the rule in the UI by triggering the record as a way to avoid filling out forms non stop just to test. This ended up exposing the issue I was encountering.
What I discovered by implementing your suggestion is that via the form submission the following smart value
{{issue.comments.last.body.substringAfter("Email address: ")}}
displays the email as test@tester.com.
the same smart value triggered in the UI provides a value of
"[+test@tester.com+|mailto:test@tester.com]"
My rule was originally using the smart value below to extract the email value for the variable since it was adding the long email "mailto:" syntax which would fail the email portion of the rule.
{{issue.comments.last.body.substringBetween("mailto:", "]")}}
Using this value I would convert [+test@tester.com+|mailto:test@tester.com] to test@tester.com so the email would successfully process.
Since I only want this to trigger when a form is submitted I ended up removing all the delays and re-fetch actions and simply changed my variable value to {{issue.comments.last.body.substringAfter("Email address: ")}}.
The submitted forms now create the issue, update the email in the custom intake email field, and adds an intake component value for intake dashboard filters.
Variable update-
Final Rule
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Brian,
Try adding a log of the Intake-Requester field after the Re-fetch to see what value is in there. If nothing, maybe try a Delay instead of just a Re-fetch to give it more time - maybe 5 seconds.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for your suggestion John. Trudy's response led me to the issue and solution.
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.