Optional Properties on Actions

I have an object type that 100 properties. I have an action that only requires 10/100 of those properties in order for the action to be executed - do I make the other properties optional by excluding them from the action?

And is there a way to by default make all properties on an action optional besides toggling them in the form?

Hi @asohrabi ,

You can always make the action to only have the 10 properties you’re trying to edit. If you want to give the user the possibility to edit those extra 90, you can group them on a section and have it collapsed by default.

If the set of properties required are variable, or in other words, you want any 10 of 100 to be required, you must move to Typescript and use Optional types

For input parameters, optional parameters are declared as varName?: <type>. For example, a Function that has an optional integer parameter named value would have a parameter value?: Integer.

Functions may declare an optional return type by specifying a type of <type> | undefined. For example, a Function that may return either an Integer or no value would have a return type of Integer | undefined.

Hey @arukavina - thanks for the response! I am specifically interested in optional properties for actions in OSDK. Would the form make these properties optional for OSDK or would I need to make them optional elsewhere?

The OSDK itself will respect the configuration set in the Ontology.

AFAIK: Once the parameters are configured as optional in the Ontology Manager, the OSDK will automatically treat them as such. You do not need to make additional changes in the OSDK code to handle optional parameters.

1 Like

Can you expand on where we are supposed to configure them as optional in Ontology Manager? On the action or the object type? Because they were already marked as optional on the object type, but the API call to the action error’d stating it expected all of them. So I believe the next place to mark as optional is in the “Rules” tab? It’s unclear the source of truth for property optionality for OSDK Actions.