Hi Team -
I'm new to Element Connect live feed custom fields, I need your help here.
I'm trying to make fields mandatory in the transition screen based on the value of a custom field which is a live SQL feed.
I have put a behaviour script for this and the script is simple and has a few lines as below
/*
Making Fields reqired on transition screen based on another field's value.
*/
def dropDown = getFieldByName("Internet Facing Apps")
def requiredField1 = getFieldByName("Test link Field")
def requiredField2 = getFieldByName("Test text field")
if (dropDown.getValue() == "App 5") {
requiredField1.setRequired(true)
requiredField2.setRequired(true)
}
else if (dropDown.getValue() == "App 10") {
requiredField1.setRequired(true)
requiredField2.setRequired(true)
}
else {
requiredField1.setRequired(false)
requiredField2.setRequired(false)
}
This is working for normal custom fields but not working for Element Connect's custom field which is a SQL feed custom field as already mentioned above.
Please anyone help me with this code.
Thanks
Chandra
What is the Connect field "Internet Facing Apps" or Test field ?
/*
Making Fields reqired on transition screen based on another field's value.
*/
import com.atlassian.jira.component.ComponentAccessor
def pluginAccessor = ComponentAccessor.getPluginAccessor();
def plugin = pluginAccessor.getPlugin("com.valiantys.jira.plugins.SQLFeed");
def serviceClass = plugin.getClassLoader().loadClass("com.valiantys.nfeed.api.IFieldDisplayService");
def fieldDisplayService = ComponentAccessor.getOSGiComponentInstanceOfType(serviceClass);
//def dropDown = getFieldByName("Internet Facing Apps")
def cfDropDownId = "customfield_XXXX"
def requiredField1 = getFieldByName("Test link Field")
def requiredField2 = getFieldByName("Test text field")
if (fieldDisplayService.getDisplayResult(underlyingIssue.key, cfDropDownId)?.getDisplay() == "App 5") {
requiredField1.setRequired(true)
requiredField2.setRequired(true)
}
else if (dropDown.getValue() == "App 10") {
requiredField1.setRequired(true)
requiredField2.setRequired(true)
}
else {
requiredField1.setRequired(false)
requiredField2.setRequired(false)
}
Replace XXX by the customfield ID of the COnnect field
Regards
Thanks for your quick response and help.
I have tried your script in behaviours but getting error in displayService function.
Could you please help me here?
Thanks
Chandra
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
Can you add
import com.valiantys.nfeed.api.IFieldDisplayService
and then replace
def fieldDisplayService = ComponentAccessor.getOSGiComponentInstanceOfType(serviceClass);
by
IFieldDisplayService fieldDisplayService = ComponentAccessor.getOSGiComponentInstanceOfType(serviceClass);
Regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Spend the day sharpening your skills in Atlassian Cloud Organization Admin or Jira Administration, then take the exam onsite. Already ready? Take one - or more - of 12 different certification exams while you’re in Anaheim at Team' 25.
Learn more
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.