function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
jon-wujon-wu 

Variable arguments for Apex Function / JS Remoting

Does Apex support variable arity or varargs?

 

I'm trying to make a flexible JS remoting method that accepts input from a variety of forms and would rather not have to change the signature of my method every time I modify the fields. I was using JSON but the JSONObject class from json.org isn't robust enough and has bugs.

 

Varargs doesn't seem to be supported either. Any ideas? If not it looks like I'll just have to make a bunch of different functions or ditch JS remoting, make a dummy page, and then send a POST to that and pull out the page params.

Kirill_YunussovKirill_Yunussov

I want to know also.

ujjwal Singh 11ujjwal Singh 11
Yes, Var-arg is not supported in apex. below is an example to support my answer.

User-added image
I hope you were asking about above functionality only if not then please let me know what is the exact question.