• merthen
  • NEWBIE
  • 30 Points
  • Member since 2008

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 12
    Replies

Is it possible to update or create or delete more than one record at a time using the REST API?  If so, how?

I have an issue where the below query is returning ALL Opportunities where the CloseDate>2010-01-01 but I only want the Opportunities where the subselect is valid.

 

Select o.Id, o.CloseDate, (Select TotalPrice From OpportunityLineItems where TotalPrice>1000000) From Opportunity o where o.CloseDate>2011-01-01

 

Is there any way to do this in SOQL while keeping the returned rows Opportunity rows and retuning ONLY the Opportunities having lines where the TotalPrice is greater than 1000000?

 

Obviously, this can be done in this manner returning OpportunityLineItem rows...but this is not what is desired

Select o.TotalPrice, Opportunity.closeDate, Opportunity.id From OpportunityLineItem o where o.TotalPrice>1000000 and Opportunity.closeDate>2011-01-01

 

I have searched this entire site for an example of how to do this but have not found anything.  I have created a sample Apex class and generated a wsdl.  I have consumed the wsdl using axis wsdl2java and imported the generated files into my Eclipse project.  The generated code produced, among other classes, a BindingStub, a PortType, a Service and a ServiceLocator.

If you look at the "normal" API login method, you must assume that the normal SoapBindStub should be replaced with the generated binding stub, etc. but there is no generated 'LoginResult' to finish up with.

Here is the code for the "normal" login...

private boolean login() {
  LoginResult loginResult = null;
  SoapBindingStub binding = null;
  try {
    //    Create binding object
    binding = (SoapBindingStub) new SforceServiceLocator().getSoap();
    //    login
    loginResult = binding.login("username", "password");
  } catch (Exception ex) {
    System.out.println("An unexpected error has occurred." + ex.getMessage());
    return false;
  }

  System.out.println("Login was successful.");

  //    Reset the SOAP endpoint to the returned server URL
  binding._setProperty(Stub.ENDPOINT_ADDRESS_PROPERTY, loginResult.getServerUrl());

  //    Create a new session header object
  //    add the session ID returned from the login
  _SessionHeader sh = new _SessionHeader();
  sh.setSessionId(loginResult.getSessionId());
  //    Set the session header for subsequent call authentication
  binding.setHeader(new SforceServiceLocator().getServiceName().getNamespaceURI(),
                       "SessionHeader", sh);

  // get user info
  try {
    GetUserInfoResult userInfo = binding.getUserInfo();
  } catch (Exception ex) {
    System.out.println("An unexpected error has occurred." + ex.getMessage());
    return false;
  }

  return true;
}

 

So, how does this work?

I'm getting a new macbook pro tomorrow which will have os x Snow Leopard.  Was wondering which version of Eclipse I should install in order to run the force.com IDE.  I see that there is a 64-bit version of 4.2.2 available for os x but I'm thinking I remember the force.com IDE supported platforms does not support 64-bit.

 

Which should I install?

 

I am trying to modify UserTeamMembers in my apex class.

The subject error was caused by this code...

 

List<UserTeamMember> teamsForDelete = new List<UserTeamMember>();

...

...

delete teams;

 

What, are we not allowed to modify UserTeamMembers in Apex?

I would like to build a visualforce page that would pull a collection of objects(same kind of objects) by query onto the page and have each object's fields editable.  The rows would be the objects and each column would represesnt an editable field. A single "Update" or "Save" button would write the changing values back to the appropriate objects.

 

I have tried using a custom controller to pass the objects to the page (works when using read-only apex "column" tags) but when I put the fields into "inputFields" within the apex dataTable, nothing displays. 

 

Any help here?

I am trying to pull the body of a "Document" into my apex class from which I would like to extract name/value pairs (like reading a properties file).
I find that the body is base64 encoded.
How can I decode that in my apex class?

For some reason I cannot query any fields other than ID via API for a few recently created custom objects.   I am using Entersprise WSDL, and a simple  query of "select id, name from my_custom_object__c".

 

The result is this error:  org.xml.sax.SAXException: Invalid element in com.sforce.soap.enterprise.sobject.SObject - Name

 

 

If I try to pull only the ID, then there are no issues.  

 

I have checked the permissions for this new object, and there seems to be no problems there - visible to all.

 

 

I have an issue where the below query is returning ALL Opportunities where the CloseDate>2010-01-01 but I only want the Opportunities where the subselect is valid.

 

Select o.Id, o.CloseDate, (Select TotalPrice From OpportunityLineItems where TotalPrice>1000000) From Opportunity o where o.CloseDate>2011-01-01

 

Is there any way to do this in SOQL while keeping the returned rows Opportunity rows and retuning ONLY the Opportunities having lines where the TotalPrice is greater than 1000000?

 

Obviously, this can be done in this manner returning OpportunityLineItem rows...but this is not what is desired

Select o.TotalPrice, Opportunity.closeDate, Opportunity.id From OpportunityLineItem o where o.TotalPrice>1000000 and Opportunity.closeDate>2011-01-01

 

I have searched this entire site for an example of how to do this but have not found anything.  I have created a sample Apex class and generated a wsdl.  I have consumed the wsdl using axis wsdl2java and imported the generated files into my Eclipse project.  The generated code produced, among other classes, a BindingStub, a PortType, a Service and a ServiceLocator.

If you look at the "normal" API login method, you must assume that the normal SoapBindStub should be replaced with the generated binding stub, etc. but there is no generated 'LoginResult' to finish up with.

Here is the code for the "normal" login...

private boolean login() {
  LoginResult loginResult = null;
  SoapBindingStub binding = null;
  try {
    //    Create binding object
    binding = (SoapBindingStub) new SforceServiceLocator().getSoap();
    //    login
    loginResult = binding.login("username", "password");
  } catch (Exception ex) {
    System.out.println("An unexpected error has occurred." + ex.getMessage());
    return false;
  }

  System.out.println("Login was successful.");

  //    Reset the SOAP endpoint to the returned server URL
  binding._setProperty(Stub.ENDPOINT_ADDRESS_PROPERTY, loginResult.getServerUrl());

  //    Create a new session header object
  //    add the session ID returned from the login
  _SessionHeader sh = new _SessionHeader();
  sh.setSessionId(loginResult.getSessionId());
  //    Set the session header for subsequent call authentication
  binding.setHeader(new SforceServiceLocator().getServiceName().getNamespaceURI(),
                       "SessionHeader", sh);

  // get user info
  try {
    GetUserInfoResult userInfo = binding.getUserInfo();
  } catch (Exception ex) {
    System.out.println("An unexpected error has occurred." + ex.getMessage());
    return false;
  }

  return true;
}

 

So, how does this work?

I'm getting a new macbook pro tomorrow which will have os x Snow Leopard.  Was wondering which version of Eclipse I should install in order to run the force.com IDE.  I see that there is a 64-bit version of 4.2.2 available for os x but I'm thinking I remember the force.com IDE supported platforms does not support 64-bit.

 

Which should I install?

 

I am trying to modify UserTeamMembers in my apex class.

The subject error was caused by this code...

 

List<UserTeamMember> teamsForDelete = new List<UserTeamMember>();

...

...

delete teams;

 

What, are we not allowed to modify UserTeamMembers in Apex?

I would like to build a visualforce page that would pull a collection of objects(same kind of objects) by query onto the page and have each object's fields editable.  The rows would be the objects and each column would represesnt an editable field. A single "Update" or "Save" button would write the changing values back to the appropriate objects.

 

I have tried using a custom controller to pass the objects to the page (works when using read-only apex "column" tags) but when I put the fields into "inputFields" within the apex dataTable, nothing displays. 

 

Any help here?

I am trying to pull the body of a "Document" into my apex class from which I would like to extract name/value pairs (like reading a properties file).
I find that the body is base64 encoded.
How can I decode that in my apex class?
I am trying to Clone a custom object in the S-Control, and I am stuck can some one share their experience of cloning the object which is having parent child relationship with other objects.