• dip
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 3
    Replies

I have an Apex method that is marked as a remoteAction which is attempting to take two parameters: a Lead and a List of custom objects ("Custom_Object__c" isn't the real object's name, just changed to protect the innocent);

 

@RemoteAction
public static Boolean insertData(Lead l, List<Custom_Object__c> customObjects) {
   // insert the Lead
   insert l;
   // assign the lead Id to each custom object in the list
   for(Custom_Object__c c : customObjects) {
      c.Lead__c = l.Id
   }
   // insert the custom objects
   insert customObjects;
   // return true (just for example)
   return true;
}

 Over in Javascript, I'm calling this remoteAction with the following data:

// sample data
var lead = {
   FirstName = 'Test',
   LastName = 'Test',
   Company = 'Test',
   Email = 'test@test.com',
   Phone = '555 555 1212'
};
var customObjects = [
   {
      Custom_Field1__c = 'A',
      Custom_Field2__c = 'B'
   },
   {
      Custom_Field1__c = 'A',
      Custom_Field2__c = 'B'
   }
];
MyApexClass.insertData(lead, customObjects, function(result, event) {
   // this would be the callback mojo
});

This code will make it as far as the insertData method, but I get the following error:

 

Visualforce Remoting Exception: undefined

 

I tried changing the insertData method to take the second parameters as List<sObject> instead of List<Custom_Object__c> (and modded the code to use dynamic DML to support this), but then I get this error:

 

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

 

I interpret this error as needing to supply a 'sobjectType' property to either a) the elements in my "customObjects" array or b) the array itself. I've tried all of the following permutations but still get the same error:

 

// ... add the property to the element doesn't work
var customObjects = [
   {
      Custom_Field1__c = 'A',
      Custom_Field2__c = 'B',
      sobjectType = 'Custom_Object__c'
   },
   {
      Custom_Field1__c = 'A',
      Custom_Field2__c = 'B',
      sobjectType = 'Custom_Object__c'
   }
];

// add the property to the array doesn't work customObjects.sobjectType = 'Custom_Object__c'; // for fun, tried to indicate that it's a list, these don't work either customObjects.sobjectType = 'List<Custom_Object__c>'; customObjects.sobjectType = 'Custom_Object__c[]';

 

Can someone point me in the right direction here? Is there another way to specify the sobjectType property? Are there issues with multiple params on a remoteaction, or issues with collection-based params? 

Hi,

 

Could you please tell me if its possible to create a site where I can put a flow (created with the flow designer) that will ask about some specific information to the client through the site and flow and then create an opportunity out of it?

 

Thanks

I have an outputPanel that has a radioList within it that I am using with an actionSupport .  I am using the actionSupport to rerender another outputPanel through the use of AJAX.  Now I would like the radioList selection to rerender more than one Panel.  I know I can obviously move the second pageBlock within the already controlled outputPanel but I was wondering if you can rerender multiple outPutPanels off of a single actionSupport?