• banderson5144Dev
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 9
    Replies

Can someone please provide me with Sample Code to create a Javascript Sobject for VF remoting? Here's what I have so far and it doesnt work:

 

Page:

<apex:page showHeader="false" standardStylesheets="false" sidebar="false" doctype="html-5.0" controller="testVFRemote">
    
    
	<input type="button" onclick="myFunc();" value="Click Me"/>
	
	<script type="text/javascript">
		
		function myFunc()
		{			
			var vfRemoteVar = {sobjectType:"Account",Name:"My New Account"};
						
			Visualforce.remoting.Manager.invokeAction(
				'{!$RemoteAction.testVFRemote.insAcct}',
				vfRemoteVar,
				function(result, event){
					alert(result);
					alert(event);
				}, 
				{escape: true}
			);
		}
	</script>
</apex:page>

 Controller:

public with sharing class testVFRemote
{
	@RemoteAction
    public static Database.Saveresult insAcct(sObject sobj)
    {
    	return Database.insert(sobj);
    }
}

 heres the error i am getting:

 

Visualforce Remoting Exception: Unable to determine SObject type: SObject. Please provide an 'id' or 'sobjectType' value.

Can someone please provide me with Sample Code to create a Javascript Sobject for VF remoting? Here's what I have so far and it doesnt work:

 

Page:

<apex:page showHeader="false" standardStylesheets="false" sidebar="false" doctype="html-5.0" controller="testVFRemote">
    
    
	<input type="button" onclick="myFunc();" value="Click Me"/>
	
	<script type="text/javascript">
		
		function myFunc()
		{			
			var vfRemoteVar = {sobjectType:"Account",Name:"My New Account"};
						
			Visualforce.remoting.Manager.invokeAction(
				'{!$RemoteAction.testVFRemote.insAcct}',
				vfRemoteVar,
				function(result, event){
					alert(result);
					alert(event);
				}, 
				{escape: true}
			);
		}
	</script>
</apex:page>

 Controller:

public with sharing class testVFRemote
{
	@RemoteAction
    public static Database.Saveresult insAcct(sObject sobj)
    {
    	return Database.insert(sobj);
    }
}

 heres the error i am getting:

 

Visualforce Remoting Exception: Unable to determine SObject type: SObject. Please provide an 'id' or 'sobjectType' value.

Hi,

 

Is it possible to export attachments for only a particular object in dataloader? I ve been trying this but no luck as yet. It is exporting all attachments available in the instance irrespective of which object record it is associated with. Tried for the following queries also but didnt help:

 

SELECT Id, Parentid from attachment where parentid like 'a0v%' (a0v is the object id I need to export from)

or

SELECT Id, Parentid from attachment where parentid like '%a0v%'

or

SELECT Id, Parentid from attachment where parentid like :'a0v%'

 

Please help me out.

 

Thanks and regards,

Dave

We are looking to speak with qualified visualforce developers to discuss projects and a potential job opportunity after discussions.

  • April 06, 2012
  • Like
  • 0