1 Reply Latest reply on Nov 6, 2009 8:09 AM by Pedro Varela

    Flex/Salesforce question, updating a unique object

    rkmallik1

      Hello, I'm having some trouble updating a value for a particular unique object from an embedded swf developed using flex.

       

      The query works fine, and returns one record (I can see the resource in a datagrid I have in the swf), however, I see no effect of my update function. Here's the relavent snippet from my .mxml file:

       

      private function setResource():void{

           //get resource

           force.query("Select Total_Hours__c, Role__c, Resource__c, Rate__c, Hours_Per_Week__c From SFDC_Assignment__c WHERE Projects__r.Id = '$$$$$$' and Role__c = '$$$$$'",

                new AsyncResponder(

                     function(qr:QueryResult):void {

                          resource = qr.records.getItemAt(0);

                     }, handleFault)

                );

           //update resource's value

           resource.Rate__c = 200;

           a1[0] = resource;

           force.update(a1, new AsyncResponder (

                function():void{

                     Alert.show("Updating...");

                }, handleFault)

           );

      }

       

      One discrepancy that I’m seeing is in the flex specific documentation, when they discuss the update function you can call on a salesforce connection: http://bit.ly/U56xx it’s a void function. However, the update function in the salesforce apex code documentation: http://bit.ly/d4Tk2 returns an array of ‘SaveResult’ object. Each element in the SaveResult array corresponds to the sObject[] array passed as the sObjects parameter in the update() call and contains information regarding the success of the update (something that would be very useful!).


      I’ve checked the sfdc database for any updates and I don’t see any for the specific operations I’m performing.


      Any one know why this isn't working? Let me know if you need any other infromation regarding our set up. Any help would be greatly appreciated. Thanks in advance.

       

      Relevent links:

       

      http://www.adnsandbox.com/media/flexsdk/docs/com/salesforce/Connection.html

      http://www.adnsandbox.com/media/flexsdk/docs/com/salesforce/Connection.html#update()