Hello, I am trying to set the project lead user via Jira automation, and I haven't been able to figure out how to do so, and I would appreciate any suggestions.
I have found how to see all available smart values, and applied that same "?expand=names" suffix to a project URL to see the additional project fields including the project lead (it helps to put the result in a JSON beautifier tool or website such as this one). The smart value in question is "{{issue.fields.project.lead.name}}", or you can just use "{{project.lead.name}}", which I have confirmed via printing its value to the audit log.
However, I don't know how to set that value via Jira Automation. If I use the Edit Issue Fields action, I can expand the Advanced field and put in the below text, but when run it fails with some errors, saying "Error while parsing additional fields. Not valid JSON."
{
"fields": {
{{issue.fields.project.lead.name}}: {{initiator}}
}
}
I fear that it is not possible to assign a smart value in this way, only read them. Can anyone confirm that? I am using Jira Server 8.7.1, and plan on upgrading to the latest Server version soon, if that matters.
Is there some way to set the project lead via Jira Automation that I am overlooking?
Thank you for your time and any suggestions you have!
Hi @Joe Morris
There is no way to do that directly with automation smart values at this time. You could try using a web request to call the REST API and update the lead for the project:
https://docs.atlassian.com/software/jira/docs/api/REST/7.6.1/#api/2/project-updateProject
Here is a how-to for calling the REST API from a web request action:
Best regards,
Bill
Hi @Bill Sheboy
Thanks for the quick reply and helpful links! You definitely answered my question.
Regarding your proposed work-around, since we haven't updated to Jira Server 8.14 or later yet, I don't have access to API tokens. Can you tell me how I can use one of the older authentication methods like OAuth to do the same thing? And is there anything else that you can see needs to be changed with my setup?
So far I have set up an automation rule with a web request action with the following:
URL: http://<site>/rest/api/2/project/{{project.key.urlEncode}}
Header: Content-Type: application/json
HTTP Method: POST (because I kept getting a 500 error with PUT, despite the latest server documentation)
Webhook body: Custom Data
Custom Data: { "lead": {{initiator}} }
For those who might not know, like myself until just now, there is a "Validate your webhook configuration" button at the bottom of the "web request" action that is much easier to use and provides more information than running the rule and checking the audit log!
I am now getting a 401 response with the following text:
Cache-Control: no-cache, no-store, no-transform
Content-Security-Policy: frame-ancestors 'self'
Content-Type: application/json;charset=UTF-8
Date: Tue, 23 Mar 2021 15:06:03 GMT
Transfer-Encoding: chunked
Vary: User-Agent
WWW-Authenticate: OAuth realm="http%3A%2F%2Fwijirasrv%3A8080%2Fjira"
X-AREQUESTID: 666x15390x2
X-ASEN: SEN-16058934
X-AUSERNAME: anonymous
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
Thank you again for your help!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Joe Morris
Sorry, I am not on server version for a while so I cannot answer the credentials issue. If no one else answers here please consider searching/posting that question on the developer community: https://community.developer.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 @Joe Morris
A little late in the discussion but I usually use this in my automations to set the current user to any user field:
{{initiator.displayName}}
Change your automation trigger as necessary.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Ronald Hipol, thank you for your reply even if it is a little late in the discussion, because I still don't have a good solution for this.
I notice that you have an action of "Edit issue fields", and the selected field is "Project Lead". I don't seem to have that option. Now, that may be because I am using Jira Server instead of Cloud, and/or it may be because my server version is currently 8.7.1 (IT is scheduled to finally upgrade to 9.4 early next year).
What version of Jira are you using, and Cloud or Server or Data Center?
Thanks again for your time!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey Joe,
We are on Jira Cloud so not quite sure if there is a difference in creating automations vs Server version.
You have to create a single user picker Custom Field first and aptly name it Project Lead and make sure to adjust the context into the applicable project.
Automation set up:
Trigger: <your choice> (ex: issue created/ transitioned/ updated)
1. Add a new component: New Action
2. Select Edit Issue
3. Key in the custom field name (ex: Project Lead)
4. Key in the smart value {{initiator.displayName}}; hit Save
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ronald,
All of the steps of setting up the automation make sense, and I have done so with other custom fields successfully in the past. However, we do not currently have a custom field named "Project Lead".
Are you saying that if you create that, and set the value, that it adjusts the Jira Project Settings to assign the project lead (i.e. see screenshot below)? This is what I need to do.
Or are you just setting a custom field that is not connected to the rest of the Jira software at all, i.e. it could just as easily be named "Team Leader"?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Joe,
You are right. The automation set up I proposed was for any custom field, like you said, could easily be named Team Leader.
I have not tried changing the Project Lead using an automation yet, and I'm not sure if it is even possible. I believe you can only change the project lead in the project settings.
You may want to explore using components if the idea is to have issue groupings like:
Sales request -> lead is John and becomes default assignee
Complaints -> lead is Joe and becomes default assignee
From there, you can create an automation to change the Component Lead whenever the component is changed.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.