Hello guys,
looking for solution to throw custom error message into the portal request screen via behaviours instead of generic one.
My behaviour is like:
def projectComponentManager = ComponentAccessor.getComponent(ProjectComponentManager)
def projectManager = ComponentAccessor.getComponent(ProjectManager)
def mandatory = false
def component = getFieldById("components").getValue() as List
if (component?.any{it.name == "ABC"}) {mandatory = true}
if (component?.any{it.name == "XYZ"}) {mandatory = true}
if (mandatory == true)
{
getFieldById("attachment").setRequired(true)
getFieldById('customfield_10201').setRequired(true)
}
else
{
getFieldById("attachment").setRequired(false)
getFieldById('customfield_10201').setRequired(false)
}
And yes, I know that attachments dont work in here, but I need to remove the optional word as well and I am checking for attachment in validator.
Need to throw custom message for CF_10201.
Tried .seterror but without success.
Lastest Scriptrunner at JSD 4.13.2
Thanks, Tom