Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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!

1 answer

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..

Suggest an answer

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

Security Advisory for Jira Service Management

On October 20, 2021, Atlassian published a security advisory for Jira Service Management. The full advisory is available at this link.  We've seen a number of questions already asking for...

316 views 1 2
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you