2

Apex method being overloaded as:

  1. Method(String param1, String param2)
  2. Method(String param1, String param2, String param3, String param4)

Whatever number of parameters we pass from helper.js to the server-side action call, it always calls the 2nd one(method with 4 params) listed above.

Any specific reason of overloading not supported?

2

Its not possible and one theory is because even in JavaScript method overloading is not supported in a traditional way.

In Lightning components an apex method is getting called in similar way, so it seems a method in Server side controller having maximum property gets the preference to be called.

|improve this answer|||||
  • Just to be clear, here overloading is done on apex side and not javascript. However, In Apex considering VF pages or component, overloading looks good. – Sikha Baid Sep 21 '17 at 12:09
  • Please refer the last line, server side controller method means of apex. – Raul Sep 21 '17 at 12:23
  • Yes, It seems to be. Anything doc/mention supporting your statement? It will help me close it. – Sikha Baid Sep 21 '17 at 12:39

Not the answer you're looking for? Browse other questions tagged or ask your own question.