Hello,
Need help in scriptrunner validator (expression) for multiline custom field. The requirement is to restrict the transition if that field (Multi line text field) is blank.
Tried using following expressions in scriptrunner validator but its working as expected.
issue.customfield_10073.plainText.length >1
issue.customfield_10073.length >1
issue.customfield_10221 != null
Please help me with the expression.
Thanks in advance.
We are trying to check a similar case. We are using multiline textfield, checking its value at transition, and adding a script at validators ( using jira expression). It works correctly the first time, but it fails if we remove the value and transition again.
We are using this expression "issue.customfield_11430 != null ".
I tried to use issue.customfield_11430 != "" && issue.customfield_11430.trim() != "" but it won't work.
I noticed it's failing for multi-line fields but works correctly for single-line text fields.
If anyone has any idea, please help me.
Hi,Raju,
I think all you need to do is not have the plainText part of your first expression whcih means you can do issue.customfield_10073.length >0 to ensure a multi line text field is not empty.
I hope this helps.
Regards,
Kristian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Kristian Walker _Adaptavist_
I already tried this, but it is not working. here are some of the screen shots.
In above case, it should be true.
Please advice.
Thanks,
Raju
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Raju,
I have tested this expression in my instance with a multi-line text custom field, and it works as expected.
Can you please save the actual validator and run this as I believe it will run as expected when the workflow transition is run as the issue you are seeing is just the test not recognising the field type correctly.
Regards,
Kristian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @raju mandapaka
You don't need to use a ScriptRunner for that.
You can accomplish that using the native Field Required Validator.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, I'm aware of it, but we are having some other fields also in that list and we need to populate dynamic error message (means if, out of 5 fields 4 fields are updated - the error message should display only for the last field which is to be filled and that needs to be done at transition screen level, which we can't do it by Field required validator.
Thanks,
Raju
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.