Post function doesn't work from customer portal

Gleb Kartashov
Contributor
April 7, 2020

Hi. I'm using Jira Misc Workflow Extensions "Scripted (Groovy) Operation on Issue Post-function" but it doesn't seem to work when executed from customer portal?

I've tested the code from editor and it worked just fine. When transition/post function is executed from Jira (not customer portal) it also works fine.

Also my post function has "Run as user:" option enabled and superadmin user is set AND is positioned lowermost in transition's post functions list.

The post function itself is a simple API call, here's the code:

import groovyx.net.http.HTTPBuilder
import groovyx.net.http.Method
import com.atlassian.jira.component.ComponentAccessor;

def cf = ComponentAccessor.customFieldManager.getCustomFieldObjectByName("Customer Request Type")
def requestType = issue.getCustomFieldValue(cf)
def path = "/rest/tts-api/latest/sla/regenerate/"
path = path + issue.key


if(requestType.toString() == "sd/b66afe4c-228d-4730-af79-d4697b4df12b"){
def remote = new HTTPBuilder("myhost.com")
def issueJson = remote.request(Method.GET) { req ->
uri.path = path
headers.'Authorization' =
"Basic ${"login:password".bytes.encodeBase64().toString()}"

response.success = { resp, json ->
json ?: [:]
}
}
}

 

How do I fix this?

4 answers

1 vote
Gökçe Gürsel {Appfire}
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
April 7, 2020

Hi Gleb,

This is Gökçe from Snapbytes - Time to SLA support.

I see that you're trying to regenerate an SLA. Can I ask you what this script is for?

Gleb Kartashov
Contributor
April 8, 2020

Hi Gökçe. I'm using this script to regen SLA because it does not automatically continue from pause when transitioned from customer portal.

Here are steps:

  1. Customer creates an issue from customer portal
  2. Assignee starts work on issue, SLA is running
  3. Assignee finishes their work, send issue to customer for review. SLA is set on pause
  4. Customer resolves issue, issue status is set to Done
  5. At this point SLA should be Met, but this just never happens

This is clearly a customer portal issue. I do not know why is this happening so I decided to design a lilttle sript to regen SLA. As you can see from my original question, it didn't work either.

Gökçe Gürsel {Appfire}
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
April 8, 2020

Hi Gleb,

Can you open a support request in our customer portal so that we can investigate this? 

Customer portal 

Regards,

Gökçe

Gleb Kartashov
Contributor
April 8, 2020

Thanks for responding! Opened ticket #1105

0 votes
Nana Kankam October 12, 2023

Hi,

is there a solution to this issue?

I have an issue that is used within jira-core and the custom portal.

Depending on a selected department in a custom field, an approver is selected and set via post function.  This works fine in jira-core but not on custom portal.

The other way around would be better.  The core user could know who the approver is, but not the external portal user.

0 votes
Tuncay Senturk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 8, 2020

Hi @Gleb Kartashov 

It is wise to track with TTS ticket, @Gökçe Gürsel {Appfire} will help you on this, however I also wanted to give some details for the users that are facing similar issues and see this post after some search via Google / Atlassian community.

Time to SLA is notified by issue events. If the transition does not fire any issue event, then your issue SLA data would not be generated.

Could you please check the post functions of that transition and make sure that it is firing an appropriate event?

0 votes
David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 7, 2020

Hi,

did you enable error reporting for the post-function to see if you get any error? Or alternatively, did you check the Jira logs (atlassian-jira.log)?

Note that you can add some logging code in your script to know what fails. Without changing any logging setting, you can use log.error("some text") which will log the "error" in atlassian-jira.log (but don't forget to remove logging code afterwards). You can also use log.debug() but you'll have to adjust the logging level for the com.innovalog.groovy package.

Gleb Kartashov
Contributor
April 8, 2020

Hi David. I've added a log writing of http request status and it says 200 even when transition is executed from customer portal.

I don't know now, maybe it is Jira API problem after all?

David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 8, 2020

Yeah. If the script runs fine, I'd say it's more likely a problem with that REST API implementation. Hopefully Snapbytes will be able to help you.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events