Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,360,317
Community Members
 
Community Events
168
Community Groups

Custom script validator to enforce an attachment from a portal request

Dirk Ronsmans Community Leader Feb 23, 2021

Hi there,

I've been racking my brain around this for a while but feel like my scriptrunner knowledge just isn't good enough :)

My requirement is that when a user creates a request through the portal and they check box/set a value somewhere that an attachment becomes mandatory.

Now we have Scriptrunner so adding it as a Custom script validator on the create transition should do the trick.

Going back to the documentation, this works fine but only when I do it on the agent view. When it is submitted through the portal the form token is empty and thus it doesn't trigger.

https://scriptrunner.adaptavist.com/6.19.0/jira/recipes/workflow/validators/validate-attachments-links-in-transition.html

 

Anybody got some ideas whether the form token needs to get capture differently when on the portal or just a different way of doing this? 

I cannot make the field mandatory all the time as it is only under certain conditions required.

Thanks for any feedback!

2 answers

Hi,

 

Did you find any solution,  i am also facing same issue form token is empy for portsl

Hi @Dirk Ronsmans I never used ScriptRunner for Jira Service Management workflows. An I only have some really old instance of Jira Software available.

But what if you add Validator to initial transition of the workflow and check attachments using  https://docs.atlassian.com/software/jira/docs/api/7.6.1/com/atlassian/jira/issue/AttachmentManager.html#getAttachments-com.atlassian.jira.issue.Issue- ?

I know there are  a lot of questions about attachments, portal requests, listeners etc. So I'm just guessing what could work :)

Hi @Martin Bayer _MoroSystems_ s_r_o__ ,

well that's indeed what I've done right now. I've added the validator to the create transition and that works great if you do it through the Agent view.

The moment you do this on the Portal it however doesn't seem to have a form token and it doesn't trigger.

So either I'm missing a method to capture that form token on the portal (which is then different from the agent/jira view) or it's a bug that it remains empty from the portal..

I'm stuck on the same problem, formToken is null from Portal and thus nothing can be checked. :(

I have the same problem as Stefano mentioned above.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira Service Management

An unofficial way to monitor a JSM mail handler for errors

...eturns true if any content is returned for the webResponse.body.data.first s...

671 views 3 20
Read article

Atlassian Community Events