I currently am using an email to import issues into my project and create issue types from there.
I want to use Automation to Add the Email/Name from my custom fields "User's Email Address" and "User's First Name" to create the Customer in Service Desk using the inbuilt functionality of Automation but the page I am seeing below is not ringing any bells for me. The email would be different everytime, should I be using the smartvalue of the email field?
From there I want to be able to make the new customer I just created the reporter of my new issue.
Any suggestions are greatly appreciated!!! Thanks in advance!
Hello @JayJuan Jones,
Welcome to the Atlassian Community!
Your assumption is correct. In order to add the customer, since every time the automation runs, it will add a new customer, on the E-mail field, it’s necessary to add the smart value of the field you created. So the automation will read this field and will invite the customer. This is also true for the Name field.
Hope this helps!
Kind regards,
Angélica
Hello @Angélica Luz !
Thanks so much for the timely reply, so I thought I was able to pull in the correct email address using {{issue.customfield_10041}} but it seems that it is not being added correctly, it shows this message
but when I check my list of customers, I am not seeing it, what could I be missing?
Also, that was only half of the problem, I am having trouble still making the new customer I just created the reporter of my new issue.
I am trying to use the Edit Issue Fields Trigger to change the reporter to match the same text as my customfield below, but I am getting this error:
MYCO-40142 (Specify a valid value for reporter (reporter))
Here is my syntax:
Please help me figure out what I am doing wrong to receive this error :(
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @JayJuan Jones,
We are testing here what would be the best approach for this rule.
For now, we were able to make this work using two different rules.
The first rule will only create the customer account when the issue is created.
The second one uses the Send web request to get the customer’s accountid and uses the Scheduled trigger and runs every 5 minutes to change the reporter. This is because it takes a while for the customer account to be created and the only way to change the reporter field is by using the ID.
We are still checking if it will be possible to use everything in one rule.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Angélica Luz even if I need to make two different rules, that would be fine with me!!! please share the details LOL
I did notice that it is taking a little time for the customers to be added to the list automatically so that would be totally fine with me, I am just over here digging away trying not to bang my head to get it to work
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jay,
The second rule would be like the one below:
When scheduled:
Then: Send web request
Web request URL:
https://<yourdomain>.atlassian.net/rest/servicedeskapi/servicedesk/<Project Key>/customer?query={{customfield_00000}}
To generate that API Token (the one that will be next to the Basic on the headers), you need to encode the credentials with base64.
$ echo -n "email@domain.com:api-token" | base64
For more detailed information, please check the article below:
And: Edit issue fields
{
"fields": {
"reporter": {
"id": "{{webResponse.body.values.accountId}}"
}
}
}
Please, take your time to test and let us know how it goes.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Angélica,
I successfully created the above described automation.
However, I would like to run this automation only for some "conditions" (custom field with user e-Mail-Adress in ticket is filled AND reporter is either member of a group or certain persons, such as call-center agents, but not the customer).
I would like to add such a condition to avoid having all the tickets revised with every run.
Unfortunately, I failed in doing so:
Trying to compare the reporter with the customer e-mail field can not be set, since I need to lookup the reporter/user-ID first. This seems not to be possible since within the if/else conditions I can not call a "web request" to fetch the user ID from the API to compare it with the reporter.
Do you have any ideas or hints how I can implement the check for the above described condition?
Thanks in advance an best regards,
Karsten
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Karsten Schulze,
It’s possible to better filter the issues that the automation will check when it runs.
The JQL would be something like this:
"custom field name" is not empty AND (reporter in membersof("call-center agents") or reporter in (“email1”,”email2”,”email3”)) AND reporter != "{{issue.custom field name}}"
Please, test using the JQL and let us know if it works. If it shows any error, feel free to share a screenshot with us.
Kind regards,
Angélica
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Angélica,
thanks for your quick reply. It worked.
I only modified {{issue.custom field name}} to {{issue.fields.customfield_100xx}}
The group (membersof) refers to globally defined groups and not "roles" within the project, correct?
I am a bit confused with groups/roles/etc. since some functions refer to roles in the project and others to (globally defined) groups.
Thanks again!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Karsten Schulze,
The membersof() it's just for groups, it doesn't work with roles.
For now, it's not possible to filter roles using JQL:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Angélica Luz okay so I have a question about the encoding of the API, is this a command I can run in the command prompt? If so, would I be replacing "email@domain.com" with my servicedesk email?
This is what I used based on the documentation provided from the link:
$ echo -n "jira@mycolorado.atlassian.net:<MhKaGtHOgW4T9UowN0Hw95EB>" | base64
and here is the output:
JCBlY2hvIC1uICJqaXJhQG15Y29sb3JhZG8uYXRsYXNzaWFuLm5ldDo8TWhLYUd0SE9nVzRUOVVvd04wSHc5NUVCPiIgfCBiYXNlNjQKCg==
should the line above be going into the Headers field next to the Authorization textbox? And if so, do I need to keep the word "Basic"?
Also, when I input my customfield id into the JQL box, I am getting this error even though this is the correct id for my customfield:
Field 'customfield_10041' does not exist or you do not have permission to view it.
Could my syntax be incorrect:
"customfield_10041" is not empty
let me know what you think.
Can an approach like this one below not be achieved anymore? why does something that seems sooo simple have to be so technical?
Solved: Set Reporter from a custom field (atlassian.com)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @JayJuan Jones,
It’s necessary to use the email address where you generated the API, in this case, your Atlassian account.
Is this a command I can run in the command prompt?
Yes, you can generate it on the token on the terminal or on the tool they mentioned in the article.
Should the line above be going into the Headers field next to the Authorization textbox? And if so, do I need to keep the word "Basic"?
Yes, keep the “Basic” and add the token after that, just leave a space between Basic and the token.
Regarding the JQL, you can use the custom field’s name instead of the ID.
"User's Email Address[Short text]" is not empty
I tested the automation from the thread you mentioned and it doesn’t work. Since that post is from 2019 at the time the Automation was an add-on, many things have changed. The only way to get the customer’s account ID is via API using the Send web request.
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.