Is there a way to dynamically set/select the number of inputs for a server action?
Hi,
I guess, no you can't set input parameters for a server action dynamically. But yes you can mention them as mandatory or not mandatory as per your requirements.
regards
What i understand you need to give input to your server actions dynamically right?
So, that should we decided according to your need you can create one server action as a function and set it output to the input of your server action.
Or
You can give user option to select first input means on dropdown change or input box change value and set that selected value to input of your server action call.
This what i understand your question or if you want you can share your OML so we will look into it.
Hope this will help you!!!
Thanks
Ruchi
Hi @Jia Le Chang ,
Can you please let me know purpose of dynamic input parameter for server action as I'm very curious to know your requirement this is something which I never thought and tried.
Thanks,
Arun
Are these inputs more like "actions". Actions the server action should take based on the interaction the user has performed in the front-end? If so I would create a custom structure with all data needed to determine the type of action and the data needed to execute the action. Then use this structure as an input list. This will give you the freedom to give a set of instructions the server action can than act upon.
Hope this helps,
Vincent
Hi, I don't understand exactly how often you want to change the entry number in server actions. If it is not frequent, you can create an "InputServerAction" structure with two attributes "name" and "value", then in your action you can create an input variable of type list InputServerAction, for validation you can always create Site properties with the number of elements you want or simply with the name of the elements you want in that list separated by commas and then compare if the list you are passing is the same as what you expect according to the site property is validation action you can use it before calling the action or inside the action and customize its output as per your criteria.