I am looking for an example email to enable email-to-case.
I have this email (epc@clearblade.atlassian.com - left of pic) and Request Type (right of pic) created:
The incoming emails will be sent by a bot in a different ticketing system. Our partner is able to configure the bot to format the sent email in any way we define, but it can only send emails (not HTTP calls etc.).
I just need a simple example email showing how one of these fields (e.g. 'Components') should be inserted in the email body in order to be parsed out successfully by JIRA to create an issue.
Hello @Akash Sharma
The email processor for JSM cannot parse the email as it is received to put the data into different fields when the issue is created. It will put the Subject of the email into the Summary field, and the Content of the email into the Description field.
If you want the Content of the email parsed and used to populate other fields in the issue/request then you will have to do that after the issue creation is completed. You could use an Automation rule with the Issue Created trigger to handle that process.
If you can dictate the format of the email content then I recommend that you tell them to put at the end of the email:
keyword: component-name
You would need to make sure you specified a value for keyword that is unlikely to be used anywhere else in the email content.
In the Automation rule you could extract the component-name from the Description using the substringAfter() function:
{{issue.Description.substringAfter("keyword: ")}}
And use that to set the value of the Components field.
If the content needs to be able to specify multiple Component values, I would recommend a comma separate list. You could iterate over the comma separated list with a For Smart Value branch, using an Edit Issues action to add each value to the Components field.
Adding to Trudy's suggestions...
If you expect multiple Component values and want to add them to one issue, rather than using an advanced branch with several issue edits, I recommend adding them all at once using a single edit with JSON. This will reduce the risk of errors / update collisions and improve the performance of the automation rule.
Please look here to learn more about that technique:
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
OK, I thought the rest would be easy but it is not. I am actually starting with a very simple single string. So in the incoming email body we would have this:
SystemKey: someString
So the keyword is SystemKey and the value is someString (with preceding whitespace removed).
I believe I'm able to use the substringAfter properly. But I am unable to set the value to a field called System Key. But that field always appears blank even though the email body clearly has the content.
I am trying to use this rule. What am I doing wrong?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hmm. Seems I have been flagged as a "Mail Loop"? How does one test these things without getting flagged?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This page talks about dealing with the Potential Mail Loop issue.
What are the details of your For branch?
What type of field is System Key?
You can use a Log action to print the value of varSystemKey into the rule Audit Log to see it contains the value you expect.
Can you provide a screen image of the output written in the rule Audit Log for the next execution if you don't get the results you expect.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Trudy Claspill I found the main problem. The first part of my rule is a "Customer Request Type Equals" clause. I thought the value was by-reference since I picked it from a drop-down. But I see now that it is a hard-coded value. The problem was after creating the rule I shortened the name of the Request Type. I see that the changed Request Type name doesn't propagate to the existing rule(s). I'll be careful not to change such names in the future since I may have several rules.
I think I'm unblocked now. Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Bill Sheboy I tried to use this link you provided...
https://support.atlassian.com/cloud-automation/docs/advanced-field-editing-using-json/#Components
...to build an email to set all the fields in one shot. Currently I've reduced my experiment to having a single field: "System Key" (a string). So I tried to send an email containing only this in the body:
{"fields": {"System Key": "abc123"}}
This did not succeed in setting the "System Key" field to "abc123". What am I missing?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What type of field is System Key?
What are the details of your FOR step?
If you have changed the rule please provide new images including images showing the details of each step.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Apologies @Trudy Claspill I wasn't able to get things working using the "For" (Advanced branching). I had success using a Then: Edit issue fields step:
I can use this approach for all the fields that need to be set (about 10 - 15). So I would have 10 - 15 of these "Edit..." steps chained together. And I can edit the rule every time new fields may need to be added. And that is fine if that is the only way to proceed.
But I'm trying to see if I couldn't use the approach Bill Sheboy suggested of using a JSON. Questions I haven't been able to answer from the documentation:
1. What should the email body contain in order to achieve the same thing I did here? I've tried sending these and neither one worked:
{"fields": {"System Key": {"value": "abc123"}}}
{"fields": {"customfield_11004": {"value": "abc123"}}}
I found out that customfield_11004 was equivalent to System Key based on some error logs I saw before.
2. How should my rule change? I think I still need the one Then: Edit issue fields step, but how would it change that? I've tried several things like checking all the fields in the Choose fields to set dropdown. But then the text boxes for each of those state This field will be cleared. So it seems I have to enter a formula in. So I tried UNchecking every field in the Choose fields to set dropdown. Neither helped.
I'm starting with one custom-field: System Key which is a string. I believe once I can figure it out for one, I can build the JSON for all the other fields.
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 field types for the fields you are trying to set?
If you have just text fields and number fields you don't need to use JSON to set them.
You can use a single Edit Issue action. You can select each field that you want to set from the Choose fields to set list.
Let us say you have three such fields to set. You need a keyword in the email content for each one:
keyword1:value1
keyword2:value2
keyword3:value3
If you dictate that they will always be present and always in the same order, one method to extract the values is substringBetween()
{{issue.Description.substringBetween("keyword1:", "keyword2")}}
That would get you value1; the information appearing after the text keyword1: and before the text keyword2.
After selecting the corresponding fields in your Edit Issue action you would type into the entry space for each of those fields the appropriate Smart Value to extract the value you need from the Description.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, and...to Trudy's excellent responses!
My earlier suggestion applies if one (or more) of the fields you want to set has multiple values. This includes: multiple-select option, labels, components, etc. For those cases, the dynamic JSON approach is needed.
For example, let's assume one of the fields is a multiple-select, option field named MyManyThings, and that same text is in the issue Description, and the values are separated by a comma and space: ", ". The dynamic JSON expression would be this:
{
"fields" : {
"MyManyThings" : [
{{#issue.description.substringBetween("MyManyThings:", "\n").trim().split(", ")}}
{ "add": { "value": "{{.}}}" } } {{^last}}, {{/}}
{{/}}
]
}
}
That works by:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks @Trudy Claspill and @Bill Sheboy. Understood that proceeding with {{issue.Description.substringBetween("keyword1:", "keyword2")}} is the best approach.
Last question (hopefully): instead of using keyword2 as delimiting the end of the value of keyword1 can I search for an EOL (End of line) somehow? No worries if not.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Please try using the "\n" for the end of the search. That will only work if there is indeed a newline character present.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Before I saw that Bill had replied, I started looking into this.
Per Atlassian's documentation on the substringBetween() function:
...there is a note following it that says
For more information, see: StringUtils. substringBetween(String, String).
Based on the information there using the newline character that Bill suggested might work. If not, you could try the Carriage Return character "\r"
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.