You need to sign in to do that
Don't have an account?
Rohit2006
Code:
How to get an Id of last inserted record using salesforce toolkit for flex
I am using create method of the salesforce toolkit for flex to enter the new record in the table and I want the ID of the inserted record to proceed further the callback function gives me the result object which when alerted using following syntax gives me a string that contains id.
Is there any method by which I can get the id of the inserted record in the code below?
Code:
private function CloneOpportunityType():void { try{ var EMASOpportunityTypes:SObject = new SObject('EMAS_Opportunity_Types__c'); EMASOpportunityTypes.Name = txtNewOpportunityTypeName.text.toString(); EMASOpportunityTypes.Description__c = txtAreaOpportunityTypeDescription.text.toString(); ta.text = EMASOpportunityTypes.toDebugString(); apex.create([EMASOpportunityTypes], new AsyncResponder( function (result:Object):void { Alert.show(ObjectUtil.toString(result)); }, genericFault ) ); } catch (err:Object) { //Alert.show(""); } }
Message Edited by Ron Hess on 08-12-2007 04:42 PM
so add this line to your callback, then run.
trace( 'new id: '+(result[0] as SaveResult).id );
Hello Ron,
Your suggestion fulfilled my requirement. I saved have saved one query per operation because of this.Thanks a lot for your help :)