I have a project automation I'm working on but I need to get a Name - that is a string format - and put into a User Picker (single user) customfield.
This doesn't resolve the name though and using a "Edit work item" doesn't work either.
Has anyone been able to use a string value to search a username that I can enter into a field, that in turn is used to become the approver for a status in a workflow?
The field has the chance to change, which is why I'm pulling it from an Asset field using a lookup. I've looked into assets and they dont have a "user" type for fields either?
AI / Rovo suggests that I can resolve the string using a lookup value?? I can't figure that out and think its tripping on a hallucination...
Hello @Tim Kennett
You cannot set a User Picker field using the display name of the user.
You could use a Send Web Request action to execute an API call to search for a user that has a matching name and extract the account ID from the results.
You can then use the extracted account ID to set the User Picker field.
If you have not used Send Web Request before, this article can help you get started.
So I got someone else to replicate this in Automation and Postman. Neither is working. I've checked the permission on the "Browse users and groups" under global permissions and we both have that and its still not working.
I'm giving up on this.
Hello @Tim Kennett
I am sorry that this has been a struggle. I have another question which might lead to a solution if you are willing to continue.
When you created your API token did you use the Create API token option or the Create API token with scopes option?
If you chose the latter:
1. What scopes did you specify. It could be that the scopes are not set correctly.
2. Try creating an API token with the first option (without Scopes) and see it that works.
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.
Hi @Tim Kennett
In assets on the object, that responds with a user/employee or else how people are defined, you can create a user attribute.
You can fill this manually or via automation, then also create another attribute last sync date.
Create a Jira automation rule that triggers based on a schedule, without using a JQL clause.
Branch the rule on an AQL search action
Create a variable, example EMAIL, with smart value: {{object.email address}}
Add a Send web request action to get the Atlassian accountID related to the email address
In the Authorisation header, make sure you add the keyword Basic followed by the base64 of your emailaddress:APItoken.
So if the base64 of the emailaddress:APItoken is AB12XY45, then to the Authorisation header add the value Basic AB12XY45
Add the following Web request URL:
https://<Cloud site URL>/rest/api/3/user/search?query={{EMAIL.urlEncode}}Add the Content-Type and "Application/JSON" header
Check the option "Delay execution of subsequent rule actions until we've received a response for this web request" as the response contains the Jira work items linked to the Confluence page
Create a variable to store the accountID of the Atlassian user, example AID, with smart value: {{webResponse.body.accountID}}
Action to edit the attributes of the user object in Assets.
Example:
user attribute: {{aid}}
last sync date: {{now.format("dd/MMM/yy")}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
OK, I'm getting a status 200 response but the body is just "[]" these square brackets? Is this an authorization issue? or the text isn't found or could it be I'm using the wrong 'Query'
https://discoveryparks.atlassian.net/rest/api/3/user/search?query=Walters
Would this work? I'm just hard coding it for the moment but no matter what I change the result is the same.
I'm doing the Header option as mentioned above Basic with the encoded base64 in the Value field.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Tim Kennett
In your Headers you should have "Authorization" where you have "Basic", and the word "Basic" should precede your encoded token in the Value field, like this:
Because your header doesn't properly include the authorization your api call is being executed Anonymously, and is returning empty results as per the specification for the API endpoint:
Permissions required: Browse users and groups global permission. Anonymous calls or calls by users without the required permission return empty search results.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yeah I tried that as well.
I did it again but still get the [] response.
I've also checked that Im in a group under Browse users and groups, global permission. I'm definately in there.
I'm at a loss as to what I'm doing wrong here? Do you need to use Oauth? The documentation seems to suggest it. No mentions it in any of the links in this chat.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The only way I have been able to replicate your results is by not having provided a valid token or by having specified a value after "query=" that doesn't actually match to any user.
Are you sure that the value provided in your query is a match for a user?
Have you tried executing the same API call directly in a browser tab?
Did you base64 encode your token properly? The article I supplied in my response shows an example of how to do that.
Did you paste the entire encoded token value into the field
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
So I just put that address into my Browser and it worked straight away, UserID, Displayname. All there. WWHHHHYYY????
Yes, if I change the value with people in the organization it works still.
So I have an authorization problem, cool.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Indeed that does sound like an authentication problem. The token you are providing is either not encoded properly, or you did not get it in its entirety when you copy/pasted it. You might try generating a new token, encoding it, and using the new encoded token.
I've also seen quirks in automation rules where the rule becomes inexplicably corrupted in the backend with no visible error in the UI. in that case recreating the rule brand new from scratch often solves the problem.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
So I got someone else to replicate this in Automation and Postman. Neither is working. I've checked the permission on the "Browse users and groups" under global permissions and we both have that and its still not working.
I'm giving up on this.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Tim Kennett
[] in you screenshot is the payload, you don't provide a payload.
You are making a GET request.
{{webResponse.accountId}} should get you the information, also use lowercase in you API call.
If you put https://discoveryparks.atlassian.net/rest/api/3/user/search?query=walters in you browser you should see the accountId
If you have the right permissions, you need to be User admin, Site or Org admin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, I am making a get request? as per the doco.
The information doesn't exist in the screenshot above, which is the validation, so if the return "Payload" is just [] how? is the {{webresponse.accountid}} going to populate anything?
yes, If i put this request into a browser it works. But again? how is that going to help me in an automation? it obviously authenticates with my id from the session I'm logged into. I'm also an Org admin.
As above, I've had someone else do this in an automation and postman. Still the same result of "nothing works" and I gave them more Admin than me. Just [] in the body/payload response status 200.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Tim Kennett
Payload, means what you provide during a post or put, you are making a get request, thus there is no payload.
DID YOU ENCODE YOUR MAIL ADDRESS and TOKEN TO BASE64?
To use api this is required, you can't just use the plain API token.
As it works in the browser, there is something wrong in the automation, probably the token.
Is the used token based on your account?
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.