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

How to insert records from flex to



I'm developing a sample application in flex. I'm trying to store the records from flex to, can anyone tell how to do this in flex.


I had tried this code to insert records from flex but its not working.Is anything wrong in my code pls check it and reply.



private function sampleinsert(lr:Object):void { force.query("SELECT Id,Department FROM Contact " + "WHERE Contact.Email=''" , new AsyncResponder(function(result:QueryResult):void { opps = result.records; })); var temp:String; //opps.Department="Medicare"; var newItems:Array= new Array(); newItem=new SObject("Contact"); //,0).Id.toString()); newItem.Id=opps.getItemAt(0,0).Id; //newItem.Name=textinput.text; //temp=opps.getItemAt(0,1).Department; newItem.Department="ssssss";; newItems.push(newItem); force.upsert("Id",[newItems], new AsyncResponder( function ():void{"ok seems like authors are saved"); } )); }


Thank You.
Message Edited by Coder on 10-22-2009 11:28 PM



Below if how you save objects from flex to salesforce.




var o:Object = {};o.impressions__C = impressions;o.cpm__C = cpm;o.product__C = product;o.cost__C = cost;o.selected__C = selected;o.allocation__C = allocation;o.type = "LineItem__C"; // o.type defines which object this is. var sObject:SObject = new SObject(o);apex.create( [sObject],new AsyncResponder(handleSaveResult,handleFault) );







That code isn't working for me. I'm getting.



FAULT (com.salesforce.results::Fault)#0 context = (null) detail = (null) faultcode = "soapenv:Client" faultstring = "Missing entity type information. sObject requires a separate 'type' field be sent."


 and the code I'm using...


var obj:Object = new Object(); obj.First_Name__c = this.firstname.text; obj.Last_Name__c = this.lastname.text; obj.Type = "T7_Candidate__c"; var sObj:SObject = new SObject(obj); var arr:Array = new Array(); arr.push(sObj); force.create(arr,new AsyncResponder(upsertResult,upsertFault));






hai leo,


I am working on flex integration,i am getting problem with inserting data to salesforce object from flex,can u pls provide code sample for me,i am struggling on this .insert data to salsforce object from flex form.



ThanksIn Advance