Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Question about isNull and fieldname substitution

Jay Keck June 7, 2022

I have multiple field validations that have to be done and I thought I'd just put them in a loop with an array of customfield ids. But the isNull field doesn't seem to accepting my field substitution when building the field name to use as a parameter, it's not detecting null fields. Is what I'm doing below  possible?

string [] fieldids = {"16601"};
for (string fieldid in fieldids) {
    if(isNull("customfield_"+fieldid)) {
       return false,"Field " + getCustomFieldNameById(fieldid) + " must be filled in";
    }
}

Thanks,

Jay

1 answer

0 votes
Jay Keck June 7, 2022

Solved my own question. I tried using variable substitution and it worked just fine!

string [] fieldids = {"16601","16805","16810"};
string customfield;
for (string fieldid in fieldids) {
customfield="customfield_"+fieldid;
if(isNull(%customfield%)) {
return false,"Field " + getCustomFieldNameById(fieldid) + " must be filled in";
}
}

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
TAGS
atlassian, likes for trees, atlassian community, social impact, tree planting campaign, community kudos, atlassian giving, environmental impact, sustainability, likes for good, atlassian social responsibility, community challenge

Make every click count—help us plant 50,000 trees! 🌳

Want to make your everyday Community actions directly contribute to reforestation? The Atlassian Community can achieve this goal by liking a post, attending an ACE, sending your peers kudos, and so much more!

Help us plant more trees
AUG Leaders

Atlassian Community Events