Updating assignee and reporter with Power Automate not working
Asked by Eir?kur Baldur ?orsteinsson:

I am trying to create a JSM issue with Power Automate and then set values to a few fields in the issue. Creating the issue and setting component and a custom field value works fine. But I have not been able to set an assignee and a reporter.

The reporter gets set when the issue is created in the first step. The action Set reporter does not set the reporter field, but clears it to unassigned. The action Set assignee does not seem to do anything.

Can anyone point out what is the required input to update reporter and assignee?

![Set reporter - Inputs.png](/t5/image/serverpage/image-id/316132i5E74EEEA7C73D56D/image-size/large?v=v2&px=999 "Set reporter - Inputs.png")![Set assignee - Inputs.png](/t5/image/serverpage/image-id/316133i764F4CA5DB0AB69C/image-size/large?v=v2&px=999 "Set assignee - Inputs.png")


Answers:
author: Krist?n ??rsd?ttir
body: [@Eir?kur Baldur ?orsteinsson](/t5/user/viewprofilepage/user-id/3702649) have you've been able to figure this out? :) K?r kve?ja


author: Marcus Jones
body: Hey [@Eir?kur Baldur ?orsteinsson](/t5/user/viewprofilepage/user-id/3702649) ,

I did some testing on my end and the issue is your headers. Remove both of your headers and make the request without them. This is my entire request  
{  
"uri": "https://\*sanitizeed_url\*/rest/servicedeskapi/customer",  
"method": "POST",  
"authentication": {  
"username": "\*sanitized_email",  
"password": "\*sanitized\*",  
"type": "Basic"  
},  
"body": {  
"displayName": "Bobby Boolean",  
"email": "\*sanitized_email\*"  
}  
}

comments: author: Eir?kur Baldur ?orsteinsson
body: Hi [@Marcus Jones](/t5/user/viewprofilepage/user-id/5132701) I removed the headers as you suggested and now I receive an error message saying "Client must be authenticated to access this resource." or "{"error":"Failed to parse Connect Session Auth Token"}", depending on how I pass on the authorization/authentication.

I am authenticating via the same API token I use for the Jira connector in Power Automate, with which I successfully create and edit issues. The user to which the token belongs can create customers in the project.

![Create Customer Error 2.png](https://community.atlassian.com/t5/image/serverpage/image-id/317969i6008C08D73341745/image-size/large?v=v2&px=999 "Create Customer Error 2.png")![Create Customer Error 1.png](https://community.atlassian.com/t5/image/serverpage/image-id/317968iBDAC047E272C0836/image-size/large?v=v2&px=999 "Create Customer Error 1.png")


author: Marcus Jones
body: At the bottom of the HTTP action in power automate set your authentication to Basic. The "UserName" should be the Jira user that the API token was created under and the Password should be your API token itself. ![Jira_API_PA.png](https://community.atlassian.com/t5/image/serverpage/image-id/317972i5F7385112BB16F1C/image-size/large?v=v2&px=999 "Jira_API_PA.png")


author: Eir?kur Baldur ?orsteinsson
body: When I do this I get this error:

![Skj?mynd 2024-04-12 130526.png](https://community.atlassian.com/t5/image/serverpage/image-id/317975i95C06E6C192F3AAF/image-size/large?v=v2&px=999 "Skj?mynd 2024-04-12 130526.png")

We would rather not give the user with the API token global administrator permission. It represents too much of a security risk in our view.


author: Marcus Jones
body: I agree, unfortunately looking at the documentation that level of permission is required for that particular call. I haven't been able to find anything thus far on how that can be scoped down.![Jira_GlobalPermissionsRequired.png](https://community.atlassian.com/t5/image/serverpage/image-id/317976iA67BC7DE54A04661/image-size/large?v=v2&px=999 "Jira_GlobalPermissionsRequired.png")


author: Eir?kur Baldur ?orsteinsson
body: Thank you [@Marcus Jones](/t5/user/viewprofilepage/user-id/5132701) .

This is indeed very disappointing. Thank you for the assistance.


author: Eir?kur Baldur ?orsteinsson
body: Hi Marcus,

if the user can create a customer in JSM, it makes no sense to require admin permission in the HTTP call.

If this were the case then other HTTP calls like Get account ID, Create issue, Create customer request, Add comment to issue, Assign issue etc. should also require admin permission, which the don't.

What needs to happen, for the permission for this HTTP call to change?


author: Marcus Jones
body: I agree 100% with you Eirikur, unfortunately from what I am seeing in the documentation, for that specific call you need those higher-level permissions. Is there a way you might be able to bulk import customers into your Jira instance? I know that is not a good way but could get you around this one call with those org level permissions.

![GlobalPermissionsRequired.png](https://community.atlassian.com/t5/image/serverpage/image-id/318628iAED08663EE3C8854/image-size/large?v=v2&px=999 "GlobalPermissionsRequired.png")


author: Marcus Jones
body: Perhaps someone smarter than me can provide additional insights, and if you find an alternative method, do let me know :)


author: Eir?kur Baldur ?orsteinsson
body: I learned that you can add an email instead of account id in raiseOnBehalfOf when using the Create customer request endpoint. If the customer does not already exist, it will be created.


author: Marcus Jones
body: Hi [@Eir?kur Baldur ?orsteinsson](/t5/user/viewprofilepage/user-id/3702649)

I've used that Power Automate connector and had the same issues. Since the connector uses the Jira Cloud API and not the Jira ServiceDesk API the reporter is always set to the user that generated the token you are using to authenticate. You will want to use the servicedesk api directly via HTTP calls and only then can you create a request on behalf of someone else. In terms of the assignee, I worked that out on the Jira automation side, but you could use the Jira ServiceDesk API to do the same. Happy to provide further assistance if you have questions!

comments: author: Eir?kur Baldur ?orsteinsson
body: Hi [@Marcus Jones](/t5/user/viewprofilepage/user-id/5132701) ,

thank you for the reply.

I understand that I need to use the Jira ServiceDesk API directly via HTTP calls, instead of the Jira Cloud API Power Automate connector.

I see there is an HTTP call called "Add request participants" in Jira ServiceDesk API and one called "Assign issue" in Jira Cloud API. I cannot however find one for updating/replacing the reporter. *Question 1: Isn't it possible to update reporter via HTTP call?*

For the value raiseOnBehalfOf in call Create customer request and the array accountIds in call Add request participants, I need the account IDs of the users. At that stage I only have their email addresses. *Question 2: How can I get a user's account ID if I only know it's email address?* I am guessing that I would have to use the call Get customers, but I wouldn't know how to get an account ID matching the email address from the response.


author: Marcus Jones
body: Hi [@Eir?kur Baldur ?orsteinsson](/t5/user/viewprofilepage/user-id/3702649) , you are exactly right. The process will consist of actually several calls. The first call will be to get the user ID. That will be a simple HTTP request with the URL where you inject the user's email as part of the URL. This will return the user ID which you can then use in your next call to set the OnBehalfOf:

![GetUserID_Jira.png](https://community.atlassian.com/t5/image/serverpage/image-id/316627i23E01F8E85D1D8B5/image-size/large?v=v2&px=999 "GetUserID_Jira.png")


author: Eir?kur Baldur ?orsteinsson
body: Hi [@Marcus Jones](/t5/user/viewprofilepage/user-id/5132701) , thank you.

If the call Get Jira User ID returns empty, I guess next I need to create a customer in JSM using the call Create customer.

There I get an error message saying the JSON content is not valid. Can you please tell why?

Flow:

![Create customer if not alreay exists.png](https://community.atlassian.com/t5/image/serverpage/image-id/316660iC6E9BE7547A320C7/image-size/large?v=v2&px=999 "Create customer if not alreay exists.png")

JSON input:

![Create customer JSON input.png](https://community.atlassian.com/t5/image/serverpage/image-id/316663i53DC9E13D7C0165C/image-size/large?v=v2&px=999 "Create customer JSON input.png")

Error message:

![Create customer Error.png](https://community.atlassian.com/t5/image/serverpage/image-id/316665iEEBAD254A8F8FB91/image-size/large?v=v2&px=999 "Create customer Error.png")


author: Eir?kur Baldur ?orsteinsson
body: Hi [@Marcus Jones](/t5/user/viewprofilepage/user-id/5132701) have you had an opportunity to look into the above?


author: Marcus Jones
body: Hi [@Eir?kur Baldur ?orsteinsson](/t5/user/viewprofilepage/user-id/3702649) , Apologies for the delay, I took my family on vacation to the beach and have been disconnected. I will look further into this as I have time tomorrow, but just to confirm, the customer you are trying to create does not exist, right?

From first glance it appears your JSON is correct. Once I can do some testing on my end I should be able to provide a better response.


author: Eir?kur Baldur ?orsteinsson
body: No worries. Hope you had a lovely time at the beach.

That is correct. The customer I am trying to create does not yet exist.


author: Eir?kur Baldur ?orsteinsson
body: Hi [@Marcus Jones](/t5/user/viewprofilepage/user-id/5132701) any luck?


Tags: cloud

jira-service-management

jira-service-management-cloud