You need to sign in to do that
Don't have an account?
tlaurie
How to Update an Opportunity
Could you point me in the right direction. I am able to query opportunities using a line of code like
Dim qr As apex.QueryResult = binding.query("Select Name, StageName, ProjectID__c from Opportunity Where StageName = 'Signed Engagement'")
Now I simply want to Update an opportunity using a query like
("UPDATE Opportunity SET ProjectID__c = '80xxx' WHERE Name = '" & opportunity.Name.ToString & "'")
but I am really stuck on the syntax. What might it look like?
Hope this helps. If you are new to SOQL it's well worth reading the 'Force.com webservices API developer's guide'. It's a long doc but full of useful info. You can find it using the search box at the top of this page.
//In this first section i tried to retrieve id using some known information :
#region Section 1
WebReference.QueryResult queryResult = new Test_ExpocadProject.WebReference.QueryResult();
queryResult = binding.query("select id from Account where name = 'XYZ', AccountNumber = '1', BillingAddress = ''");
WebReference.Account acc_getid = new Test_ExpocadProject.WebReference.Account();
acc_getid = (WebReference.Account)queryResult.records[0];
string id = acc_getid.Id;
#endregion
//In this section you can update using known id which u want
#region Section 2
Account acc_Object = new Account() //But here i think u need to create Opportunity object in the same way.
acc_Object.Note__c = txt_Note.Text; //Here Note__c is my custom field which i want to update.
acc_Object.Id = id; //this id is the known value.
try
{
WebReference.SaveResult[] srArray1 = binding.update(new WebReference.sObject[] { acc_Object });
}
#endregion
** I thinkit should work... Just change it to VB code.
Raj S
Here're the codes how to update the Salesforce Account object using VB .NET:
' Create the new Account object to hold our changes
Dim upAccount As Account = New Account
' Need to have the Id so that the system knows which Account to update
upAccount.Id = "0015000000Oyn1A"
' Set a new value for the Billing City property
upAccount.BillingCountry = "Canada"
' Call the update passing an array of object
Dim SaveResults() As SaveResult = binding.update(New apex.sObject() {upAccount})