You need to sign in to do that
Don't have an account?
gtuerk
Update data using as3Salesforce.swc
I'd like to update some records based on user interaction with a Flex SWF. I can't find examples of the syntax for Updates. Do I just use connection.query and specify an update statement? Is that formed like SQL?
update [table] set [columnList[a]=value,[columnList[b]] where id = :[id]?
I'm already directly querying (rather than using the WebService API) so ideally I could use the flex toolkit to make those updates based on ActionScript. Thanks
Here's a small snippet to update a campaign member's status. The variable "sfdc" is the connection object.
public function updateCampaignMember(myObject:Object):void {
// create a new array to pass to sfdc
var aSo:Array = new Array();
// populate the SObject to send to sfdc
var so:SObject = new SObject("CampaignMember");
so.Id = myObject.CampaignMemberId;
so.Status = myObject.Status;
// add the object to the array for the sfdc call
aSo.push(so);
sfdc.update(aSo,
new AsyncResponder(
function results(obj:Object):void {
if (obj[0].errors != null) {
Alert.show("Could not change the status of the Campaign Contact. ["+obj[0].errors[0].message+"].","Error");
}
}
)
);
}
I have some more Flex examples on my blog below.
Vote for my Idea: Enhanced Apex Testing Functionality (JUnit) Link
Jeff Douglas
Informa Plc
http://blog.jeffdouglas.com
All Answers
Here's a small snippet to update a campaign member's status. The variable "sfdc" is the connection object.
public function updateCampaignMember(myObject:Object):void {
// create a new array to pass to sfdc
var aSo:Array = new Array();
// populate the SObject to send to sfdc
var so:SObject = new SObject("CampaignMember");
so.Id = myObject.CampaignMemberId;
so.Status = myObject.Status;
// add the object to the array for the sfdc call
aSo.push(so);
sfdc.update(aSo,
new AsyncResponder(
function results(obj:Object):void {
if (obj[0].errors != null) {
Alert.show("Could not change the status of the Campaign Contact. ["+obj[0].errors[0].message+"].","Error");
}
}
)
);
}
I have some more Flex examples on my blog below.
Vote for my Idea: Enhanced Apex Testing Functionality (JUnit) Link
Jeff Douglas
Informa Plc
http://blog.jeffdouglas.com
Jeff
This is exactly what I was looking for. Thanks much for the quick response!!!
-Gabe
p.s. I totally agree with your idea on better unit test [Setup] support and have already voted it up