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

Making Fields mandatory based on Element Connect SQL feed custom field

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

 

1 answer

0 votes
Florian Bonniec
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Sep 19, 2022 • edited

Hi @Sekhar 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 

Hi @Florian Bonniec 

 

Thanks for your quick response and help.

I have tried your script in behaviours but getting error in displayService function.

 

image.png

 

Could you please help me here?

 

Thanks

Chandra

Florian Bonniec
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Sep 22, 2022

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

Suggest an answer

Log in or Sign up to answer