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
WimWim 

Call dynamic method

Hi gurus,

 

is it possible to call a method dynamically?

For instance, I have a class with method a. Within this method I want to call another method with some checks based on the given objectname. These methods start with Authorize and then the objectname, I have something like this but of course the last line does not work.

 

String obj = 'Authorize' + ObjectName + '()';
obj.replace('_','');
authorized = obj;

 

Is it possible to build up the method name dynamically and then call it?

 

Kind regards,

Wim