Need help on running scriptrunner tasks.
Hi All,
I am having few customizations to be made, I have been asked to use scriptrunner to write the scripts. Can anyone please help me with any complete cycle of script.?
I am having backgruond in Java, so groovy (scripting language of the tool) shouldn't be an issue, but I don't know from where and how to run the scripts.
The problem statement is, I am having 1 custom field, and I need to mark it compulsory for specific status and I also want to make it display on the specific condition.(For instance the custom field should be only displayed when issue status is in "In progress" or "completed" state)
Any suggestions are welcomed.Moreover any document/article/video as well should be fine if it depicts a complete cycle of scriptrunner flow.
Thanks
We have 2 custom fields and we want to change the value of field 1 dynamically based on the value of field 2(For instance, when field 2 will have some value then field1 should be mandatory and if field 2 has no value then field 1 should be non mandatory).We need some kind of function in scriptrunner which is similar to jQuery onChange() .Please let me know how this could be achieved ?
Ok, that is the sort of thing Behaviours are for.
It seems you have not yet looked at creating a Behaviour, otherwise you would have seen that it asks you for information that can guide you through this reasonably easily.
Select a field to run the behaviour on, (Probably field 1 in your case), and then add the code for your logic. When you go into the editor for the code, look beneath it, as it has a quick reference guide for things like "get current field data", "set field data on-screen", "show/hide field" and "set field optional/required".
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Here in above image can you please tell that which method will be helpfull for below task :
"We have 2 custom fields and we want to change the value of field 1 dynamically based on the value of field 2(For instance, when field 2 will have some value then field1 should be mandatory and if field 2 has no value then field 1 should be non mandatory).We need some kind of function in scriptrunner which is similar to jQuery onChange() .Please let me know how this could be achieved ?"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'd use the getFieldByName and setRequired you found in the table of help. It's good to read and learn new stuff.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
yes...Can you please help to suggest to solve below problem
"I have 2 custom field (for DATE) , If I select any date from 1 field than in another filed DATE PICKER should show equal or greater date of SELECTED date of 1st field. I can say in 2nd date field DATE PICKER should DISABLE the EARLIER DATE from selected 1st Field date. And the 2nd field should not accept earlier date than selected date of 1st field [if user change manually after selecting 1st date]
So can you suggest how can I achieve ?? "
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If you are on Jira Server/Data Center then you could use behaviours
https://scriptrunner.adaptavist.com/4.3.1/jira/behaviours-overview.html#_description
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for update.
I have written Script to connect database having table containing
data. Still it is retrieving null in output.
Please suggest me if any step left ??
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That is not the right approach to writing the Behaviours and validators to solve your problems.
Could you explain where you're actually stuck
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You should use
getFieldByName to get your custom fields
def cs1 = getFieldByName("customField1Name")
def cs2 = getFieldByName("customField2Name")
then you should check the value and set the other field to required
if (cs1.getValue().equals("value")) {
cs2.setRequired(true);
} else {
cs2.setRequired(false);
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.