Install Option questions/wishes

#1

ShowIf Question

showIf in the options is nice but it seems to only allow 1 value to be checked? If so, can that get expanded?

My use case: I have an advanced option that I want to show if the fieldA == 'val1' OR otherField 1= ''. Having those multiple conditions would allow me to simplify the options that I have. I could see this as an array being passed to the showIf for the combined operations showIf: [ conditionObj, ‘or’, otherConditionObj ]

List Length Question
Another condition I would love to be able to use is the size/length of a list. showIf: { optsList[].length > 3 }
In addition, having a max length would be excellent.

It’s quite possible that these capabilities already exist and I am not finding them but I would love help with these. Also, if someone from the product team would like to get more feedback on this whole experience I’d love to pass along that help.

#2

Just found the maxItems option for a list. But I’d like to be able to have a maxItems based on a what product they selected

1 Like
#3

So apparently you can use multiple keys in the showIf and they will be combined with a &= which means it will only show if all key conditions are true. But what I am really looking for is if 1 or more conditions are true

#4

@cscharff @victoria is there someone that can assist me with these features as they are pretty small when looking at the code driving the options? Specifically needing an “OR” condition and the ability to look at a list’s length property.

#5

Sorry for the delay there. OR behavior can be accomplished through the method field using any. The full list of supported method s are:

  • any : at least one entry matches the criteria.
  • all : all entries match the criteria.

For more details: https://www.cloudflare.com/apps/developer/docs/install-json/options

2 Likes
#6

From my understanding that only does OR based on an individual property’s value. Meaning obj.prop value is “a” OR “b”. My need is checking if one of two showIf objects are true. As in:

showIf: {
   prop.a: 'enumVal',
   prop.b: {
      op: "!="
      value: ""
   }
}

where the goal is, only show if prop.a is ‘enumVal’ OR if prop.b is not an empty string. Right now, each property does an AND.

I am trying to build an override field that is only visible if the user selected to have that specific override or if the override field is not empty. Allowing users to not avoid seeing a large list of override fields only seeing the ones they opt into seeing.

#7

Currently this is not possible using dynamic install options. You’d have to incorporate that logic in your app.

#8

Is there someone I can talk to about adding this as a feature? The main goal behind using this is to reduce the number of options I need on the install screen. Not having this means I have to show a lot of options and the only way to limit them is boolean flags which… are more options. I inspected the code behind this and it seems like a relatively minor feature to add.