While working with Visualforce pages along with javascript remoting functionalities, we often create a lot of callback methods. On top of it, multiple invocations in a chained approach is more chaotic, often hardcoded and leaves code quite unreadable. Following is an example code while using Javascript remoting within Visualforce page:- function invoke_remoteService1 (){ console .log ( ' Invoking remote service 1' ); Visualforce.remoting.Manager.invokeAction( '{!$RemoteAction.testWebServiceController.remoteService1}' , remoteService1_ResponseHandler); } function remoteService1_ResponseHandler (response, event){ console .log ( ' Response from remote service 1 = ' + response); if (response ! = null ){ console .log ( ' Invoking remote service 2' ); Visualforce.remoting.Manager.invokeAction( '{!$RemoteAction.testWebServiceController.remoteService2}&
Sharing insights, ideas and learnings while implementing Salesforce based solutions for various enterprises. Learn more about Salesforce intricacies and some quick insights into complex or unknown areas.