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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

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,554,077
Community Members
 
Community Events
184
Community Groups

Workflow Condition Script Runner - how to set error message to single line text field

If the condition is false I need to set a message into a customfield that is fieldtype single line text field.

below is the code I have for the customfield

def cf2 = ComponentAccessor.getCustomFieldManager().getCustomFieldObjects ByName('Transition Blocker')

In the condition it does not allow me to

get the custom field value and then getFieldByID and set the FormValue or per documentation do

cf2.setError ("this is it)

else 

cf2.clearError()

Using script runner version 7.8.0

 

1 answer

0 votes
Fabio Racobaldo _Herzum_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Mar 24, 2023

Hi @Nannette Mori ,

first of all workflow condition defines if a transition button should appear or not. Based on that there's no way to set an error. If you need that, my suggestion is to use a workflow validator instead.

Hope this helps,

Fabio

I just realized those conditions are in behaviours

We don't want the transition button to display but we also want the users to know why

How do you check on the condition that was  created in the workflow in the validator?

Fabio Racobaldo _Herzum_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Mar 25, 2023

@Nannette Mori , if you use behaviour you can just put the error on your field using the following code :

def cf2 = getFieldByName("Transition Blocker")
cf2.setError ("this is it)

This should fix your issue. You don't need to take cf through CustomFieldManager.

 Fabio

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
VERSION
9.4.3
TAGS
AUG Leaders

Atlassian Community Events