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
vino2vijayvino2vijay 

How to return List<Sobject> in javascript remoting ?

Hi All,

 

I am using javascript remoting for my application . I wanna return List<Sobject > from APEX method to Javascript ? once its done, How to parse the list of records in Javascript ?

 

Thanks in Advance,

Best Answer chosen by Admin (Salesforce Developers) 
hitesh90hitesh90

Hi vijay,

 

Here is the sample example for your requirement

 

 function getRecordListJS() { 
 Visualforce.remoting.Manager.invokeAction(
	'{!$RemoteAction.AccountRemoter.getRecordList}',
	recordName, 
	function(lstresult, event){			
		for (var n=0; n<lstresult.length; n++){
			var result = lstresult[n];
		},{escape: true});
}

 

Important :

Hit Kudos if this provides you with useful information and if this is what you where looking for then please mark it as a solution for other benefits.

 

Thanks,

Hitesh Patel

 

 

All Answers

hitesh90hitesh90

Hi vijay,

 

Here is the sample example for your requirement

 

 function getRecordListJS() { 
 Visualforce.remoting.Manager.invokeAction(
	'{!$RemoteAction.AccountRemoter.getRecordList}',
	recordName, 
	function(lstresult, event){			
		for (var n=0; n<lstresult.length; n++){
			var result = lstresult[n];
		},{escape: true});
}

 

Important :

Hit Kudos if this provides you with useful information and if this is what you where looking for then please mark it as a solution for other benefits.

 

Thanks,

Hitesh Patel

 

 

This was selected as the best answer
vino2vijayvino2vijay

Hi hitesh,

 

I got it .. Thank u for ur solution .... Also can u please let me know how to bind this results to pageblock table component ?

 

i wanna display more the one record in pageblock component . How ? I have parsing result in Javascript only rite ?

 

can u please help me on this case also ?

 

Thanks,

hitesh90hitesh90

Hi vijay,

 

Refer this Link Javascript Remoting this is similar to your requirement.

 

Important:
Hit Kudos if this provides you with useful information and if this is what you where looking for then please mark it as a solution for other benefits.

 

Thanks,
Hitesh Patel