0

I'm using PHP and SOAP OR REST to access the data from my Salesforce Account. I want to know if there's a way for me to do a query or something like it to update or insert some records? I haven't been able to find a way. Thanks!

1 Answer 1

1

You can use Develop- API- create Enterprise WSDL then in PHP you need to do a web reference(reference the WSDL from Salesforce). I have done something similar in .Net here is the code so you can use it as a reference. The name of the Web-reference is sforce.SforceService

hope it helps

  protected void Button1_Click(object sender, EventArgs e)
{

    //Updating Salesforce
    sforce.SforceService service = new sforce.SforceService();
    sforce.LoginResult lr = service.login("username", "passw+token");
    service.Url = lr.serverUrl;
    service.SessionHeaderValue = new sforce.SessionHeader();
    service.SessionHeaderValue.sessionId = lr.sessionId;



    //SQL Query
    String queryString = "Select id, Amazon_Listing_Level__c, Amazon_Rule__ID__c, ESTShipPrice__c from vendors2";

    SqlDataReader dr = classdb.LoadReader(queryString) as SqlDataReader;

    sforce.NRProducts__c nrProduct = new sforce.NRProducts__c();
            while (dr.Read())
            {

            nrProduct.Id = dr[0].ToString();
            nrProduct.Amazon_Listing_Level__c = dr[1].ToString();
            nrProduct.Amazon_Rule_ID__c = Convert.ToInt32(dr[2]);
            nrProduct.Amazon_Rule_ID__cSpecified = true;
            nrProduct.ESTShipPrice__c = Convert.ToDouble(dr[3]);
            nrProduct.ESTShipPrice__cSpecified = true;



            }
            sforce.SaveResult[] update_result = service.update(new sforce.sObject[] { nrProduct });

            dr.Close(); 


            }

}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .