Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Scriptrunner CLOUD post function run as ScriptRunner Add-On User - can this be edited

Mordechai Cikk
Contributor
August 30, 2018

Hi.

Running on Cloud, we have a script postfunction that generates a Service Desk ticket for a SD cusomer.

Works great.

However a complaint did come back that the first email that goes out to the SD customer is "From: ScriptRunner for JIRA".

I cannot run the postfunction as the Initiating User since that user is not an Admin and cannot execute the Rest API calls in the postfunction that interfaces with SD.

Is there a way to change the Initiating User from within the script?
Or modify the text for the ScriptRunner Add-On User ?

I did find one old post from Jamie relating to changing the user. It points to https://studio.plugins.atlassian.com/browse/GRV-155?_ga=2.103235145.813475430.1535260421-831551202.1528974150  but get  "This site can’t be reached"   

Anyone know if this is currently possible? 

 

Thanks

Mordechai

 

1 answer

1 accepted

1 vote
Answer accepted
Kristian Walker _Adaptavist_
Community Champion
September 4, 2018

Hi Mordechai,

Thank you for your question.

I can confirm that on Jira Cloud it is not possible to modify the From user meaning that the from user will be the user who ran the script.

The reason for this that Jira Cloud does not provide any API to switch the user in the script which means that if the iniating user does not have the correct permissions then you will have to keep the script running as the add on user.

I understand that it is frustrating having the from user for the notification show as the ScriptRunner add on user but as explained this is a limiation of Jira Cloud. 

If this response has answered your question can you please mark it as accepted so that other users can see it is correct when searching for similar answers.

Regards,

Kristian

Mordechai Cikk
Contributor
September 5, 2018

Hi Kristian.

Thank you for your reply.

 

Mordechai

Mordechai Cikk
Contributor
November 19, 2018

Hi Kristian,

There is one other big problem that we are having.

I would expect that running the script postfunction that creates a SD Customer and ticket  via REST Api call should require that the initiating user (if not the Scriptrunner Add-on User)  be an SD Agent. After all, the Agent has permissions to do all of those activities.

But when it is run by an Agent we get the following error:

2018-11-19 14:59:14.172 WARN - POST request to /rest/servicedeskapi/customer returned an error code: status: 403 - Forbidden
body: [errorMessage:Insufficient permission to perform requested action, JIRA Administrators global permission is required., i18nErrorMessage:[i18nKey:sd.rest.error.permission, parameters:[JIRA Administrators global permission]]]

Would be great if you can shed some light on why the Agent is not enough.

 

Thanks very much

Mordechai

Kristian Walker _Adaptavist_
Community Champion
November 19, 2018

Hi Morchendi,

I can confirm that this error is explained in the Create Customer API documentation from Atlassian at https://developer.atlassian.com/cloud/jira/service-desk/rest/#api-customer-post.

The reason for this error is that Atlassian only allow users who have the Jira Administrator Global permission granted on their account to access this REST API and this the reason why Agent privellages is not enough. 

Please note that ScriptRunner is only able to use the API's provided by Atlassian so has to follow the restrictions implemented by the API and cannot work around these.

Regards,

Kristian

Suggest an answer

Log in or Sign up to answer