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

Custom script validator to enforce an attachment from a portal request

Dirk Ronsmans
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 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

0 votes
Muhammad Ramzan May 11, 2022

Hi,

 

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

0 votes
Martin Bayer _MoroSystems_ s_r_o__
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 23, 2021

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 :)

Dirk Ronsmans
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 23, 2021

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

Stefano Coletta May 9, 2022

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

Negin Nafari June 14, 2022

I have the same problem as Stefano mentioned above.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events