Hi friends,
So, I have something which is driving me kinda crazy. I'm trying to write a validation logic rule where if a particular multiselect field is selected along with any other field that the validation error kicks in.
Here's the formula:IF(ARRAYLENGTH({DE:fieldName})>1&&CONTAINS({DE:fieldName},"option"),"Option must be the only contract selected. Adjust this and resubmit.")
Now, this is a valid expression. However, it isn't validating. I've been trying to cheat with Copilot and Grok and neither are giving me something which works.
This is killing me because there's gotta be something simple that I'm clearly not seeing.
Help?
-j
Views
Replies
Total Likes
sorry, I'm not clear. Are you saying it's a valid expression because it didn't error, or are you saying "I tested it out as a calculated field, and it gave me the results I'm looking for"?
Views
Replies
Total Likes
Sorry. What I'm saying is that Workfront is allowing me to save the expression. The syntax is correct but it's just not validating when I attempt to make it validate on a sample document.
Views
Replies
Total Likes
Sorry, I should have said "what result do you get if you make a test calculated field with this same expression?"
Views
Replies
Total Likes
Oh man, sorry. It's been a day.
If someone selects that field and something else, the system should prevent the form from being saved. Right now, we have "<Contract Name> - MUST BE THE ONLY CONTRACT SELECTED" as the value. And I don't know if it's an Aetna peculiarity, but no one seems to read. 😄
We made it like this because Validation Logic didn't exist at that point. But now that it does....
-j
Views
Replies
Total Likes
Got it, so you have the calculation in a calculated field, and it works there, but it doesn't work when you paste it into a validation logic statement. And then, do I have the understanding right that if I have a field, "Fruit" and options are "apple", "peach", "tomato", you want to write out some validation so you can multi select different options, unless you select "tomato" in which case it must be the only option selected?
Views
Replies
Total Likes
Exactly this. Works elsewhere but it doesn't work when using it for validation logic.
I'm wondering if I do validation logic on a calculated field if that may suffice. Because as it is, I've stumped one of the foremost wizards with text mode, along with Grok. 😄
-j
Views
Replies
Total Likes
hey John, not sure if you saw my other message or not but I wasn't able to get your original calculation working at all, as a calculated field. It may be that I didn't start with the same field as you did (I use a multi select dropdown field), but I first was not able to get an array length without converting my field to an array. Then, I noticed a syntax error in your contains expression. All this to say, I posted a suggested fix using the type of syntax that would normally work in Workfront -- you might try that to see if it gives you a better result.
Views
Replies
Total Likes
John, I can't get your calculated field working either. Honestly don't know how it's working on your side. For my side, what does work as a calculated field is the following:
Views
Replies
Total Likes
Views
Likes
Replies