Making the hyperlink mandatory in comment while transitioning

Mahanth Prudhvi P April 4, 2024


Hi, I have a scenario where I am making the comment mandatory while transitioning from status to status and I want to make sure user is also mentioning any link in comment and how can I achieve it.

Thanks.

2 answers

1 accepted

1 vote
Answer accepted
Jack Brickey
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 4, 2024

Hi @Mahanth Prudhvi P , there isn't any means of requiring a user to add a link to a comment. If you need a link consider using a URL custom field and requiring on transition using a Validator.

Mahanth Prudhvi P April 4, 2024

Hi @Jack Brickey ,

Thanks for your response. I guess may be we can check if the user has mentioned any link in the comment using the automation. Is that possible?

Jack Brickey
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 4, 2024

You could likely inspect for URL in the last comment following the transition (trigger) and if none found the email the user or even revert the transition if desired. But this is after the fact. Again if this URL is a requirement then I would use a custom field.

Mahanth Prudhvi P April 4, 2024

@Jack Brickey Thank you

I am attaching the current configuration which I am currently using. Is there any better approach that you wanna share

Screenshot (162).png

1 vote
Kishan Sharma
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 4, 2024

Hi @Mahanth Prudhvi P 

First, add a new screen in Jira without adding any fields to it, as the comment field will be added by default.

Next, include the newly added screen in the workflow transition screen. Then, navigate to the Validators section in the workflow and choose Field Required validator. Within this validator, select Comment as the required field for transition and provide an error message.

Finally, publish the workflow so that it functions as expected.

Now, if you want to capture a URL, you can use any existing custom field of type URL or create a new one and add that to the screen you created and also add a validator to make it mandatory.  For example, I have created a transition screen below while transitioning from To Do to In progress and it does not let me transition unless I provide the input.

2024-04-04 17_06_22-In Progress - Jira.png

Refer this post for reference.

Mahanth Prudhvi P April 4, 2024

Hi ,

@Kishan Sharma Thanks for the response.

 

I am actually using everything as you mentioned above but instead of going with extra field(for URL) I would like to know if there is any possibility to check if the user has mentioned any link in the comment section.

Floating electron
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 4, 2024

Using Jira Expression Validator, you can write following expression:

let lastCommentIndex = issue.comments.length -1;
issue.comments[lastCommentIndex].body.plainText.includes('https')

or even using regex for urls 

let lastCommentIndex = issue.comments.length -1; 
let linkReqex = 'https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)';
issue.comments[lastCommentIndex].body.plainText.match(linkReqex) != null

There are several apps available on the marketplace, which you can use.

We've developed the Jira Expression Validator as part of the free  Workflow Building Blocks for Jira  app. I would appreciate it if you could give it a try.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events