Hi I am trying to write a script runner simple validator script which validates two fields
What I am trying to do is to check if at least one of them was selected
The customer is multi-select and the Device Related is single select
both are getting the data from Insight objects
Steps I did
This is what I am trying to do
cfValues['Customer'] || cfValues['Device Related']
In this case, I can not create the issue
Using only cfValues['Customer']
Works for customer field (validation works as expected)
cfValues['Device Related'] alone does not work
I could not find anything in the logs can someone direct me the correct log or what to look for
Thanks for the quick reply
The cases are very simple :)
During the create I am trying to save the issue with values
By the way, something I did not write in the original question is that
alone does not work
This is customer env I asked for logs I should get them tommorrow
I will update if I will find something there
It is good to know that my script is valid
I see, you will need to use the ids then :
int insightId1 = 12001
int insightId2 = 12002
def insightValue1 = issue.getCustomFieldValue(ComponentAccessor.getCustomFieldManager().getCustomFieldObject(insightId1))
def insightValue2 = issue.getCustomFieldValue(ComponentAccessor.getCustomFieldManager().getCustomFieldObject(insightId2))
insightValue1 || insightValue2
As a rule of thumb I strongly disadvise to use two custom fields with the same name. It can quickly become confusing in the scheme configurations, backups, and can mess up your code.
That is also why I recommend to always use id in the code, so that you can rename the custom field without consequence.
Introducing Jira Cloud for Excel Here at the product integrations team at Atlassian, we are thrilled to announce the new Jira Cloud for Excel add-in! This add-in lets you export Jira data directly ...
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events