• ashoknaglikar1.3945534997003162E12
  • NEWBIE
  • 5 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 4
    Replies
Hi I have a situation. 

I have a database where we have following relationship Student (grand parents ) --> (look up )year ( parent) --> (master detail ) subject marks  (grand child).

Relation ship fields can't be changed to any other type . 
I need to update avg marks for every subjects on to respective student records as and when mark records added or modified . 

I have tried creating a  a roll up summary on the year object to calculate the total marks and used a trigger to populate the avg on the student record as the roll up summary fields are calculated at the end . So it's not working as expected any suggestions . 
 
If any call is made on partner connection, the control does not come back from the call. For an example, please refer below code. Call to api using partner connection is highlighted in yellow which does not give control back after keep it running 20 mins (or more). The line highlighted in RED is not executed. 
import com.sforce.soap.partner.DescribeSObjectResult;
import com.sforce.soap.partner.Field;
import com.sforce.soap.partner.PartnerConnection;
import com.sforce.soap.partner.QueryResult;
import com.sforce.soap.partner.sobject.SObject;
import com.sforce.ws.ConnectionException;
import com.sforce.ws.ConnectorConfig;
 
public class TestApp {
    public static void main( String[] args ) throws Exception {
   
           ConnectorConfig config = new ConnectorConfig();
           config.setUsername("bigdatasupport@centrica.com.test1");
           config.setPassword("welcome1QN4MUrZwAWZ6qEk5OpX13TEUG");
          config.setAuthEndpoint("https://test.salesforce.com/services/Soap/u/33.0");
           config.setTraceMessage(true);
           config.setPrettyPrintXml(true);
           PartnerConnection partnerConnection = new PartnerConnection(config);
          
           System.out.println("Partner Connection : " + partnerConnection);
          
           DescribeSObjectResult info = partnerConnection.describeSObject("Account");
           Field[] fields = info.getFields();
           System.out.println("Fields : " + fields);
           String query = SalesforceUtils.generateSOQL(fields, "Account");
           //querySample(partnerConnection, "Account", "");
           System.out.println("run Ended======>>>>");
    }
}


Any one who faced similar problem. Please help.

we are using salesforce eclipse to execute the code.
If any call is made on partner connection, the control does not come back from the call. For an example, please refer below code. Call to api using partner connection is highlighted in yellow which does not give control back after keep it running 20 mins (or more). The line highlighted in RED is not executed. 
import com.sforce.soap.partner.DescribeSObjectResult;
import com.sforce.soap.partner.Field;
import com.sforce.soap.partner.PartnerConnection;
import com.sforce.soap.partner.QueryResult;
import com.sforce.soap.partner.sobject.SObject;
import com.sforce.ws.ConnectionException;
import com.sforce.ws.ConnectorConfig;
 
public class TestApp {
    public static void main( String[] args ) throws Exception {
   
           ConnectorConfig config = new ConnectorConfig();
           config.setUsername("bigdatasupport@centrica.com.test1");
           config.setPassword("welcome1QN4MUrZwAWZ6qEk5OpX13TEUG");
          config.setAuthEndpoint("https://test.salesforce.com/services/Soap/u/33.0");
           config.setTraceMessage(true);
           config.setPrettyPrintXml(true);
           PartnerConnection partnerConnection = new PartnerConnection(config);
          
           System.out.println("Partner Connection : " + partnerConnection);
          
           DescribeSObjectResult info = partnerConnection.describeSObject("Account");
           Field[] fields = info.getFields();
           System.out.println("Fields : " + fields);
           String query = SalesforceUtils.generateSOQL(fields, "Account");
           //querySample(partnerConnection, "Account", "");
           System.out.println("run Ended======>>>>");
    }
}


Any one who faced similar problem. Please help.

we are using salesforce eclipse to execute the code.

 

Page size is 10, Total records = 17.code that is being called:

 

 

this.setCtlr.next();
//populateData iterates using getRecords()
populateData();

 

 

Debug Log is below:

 

18:51:36.359|USER_DEBUG|[4]|DEBUG|>>>>>>>>>>>>>>>> MyMarketController>>>>>>>>>>>setCtlr.TotalSize=17
18:51:36.359|METHOD_EXIT|[4]|System.debug(ANY)
18:51:36.359|METHOD_EXIT|[202]|ALMLogUtils.log(String, String)
18:51:36.359|METHOD_ENTRY|[203]|01pQ00000004ZfQ|ALMLogUtils.log(String, String)
18:51:36.359|METHOD_ENTRY|[203]|ApexPages.StandardSetController.getHasNext()
18:51:36.359|METHOD_EXIT|[203]|ApexPages.StandardSetController.getHasNext()
18:51:36.359|METHOD_ENTRY|[4]|System.debug(ANY)
18:51:36.359|USER_DEBUG|[4]|DEBUG|>>>>>>>>>>>>>>>> MyMarketController>>>>>>>>>>>setCtlr.HasNext=true
18:51:36.359|METHOD_EXIT|[4]|System.debug(ANY)
18:51:36.359|METHOD_EXIT|[203]|ALMLogUtils.log(String, String)
18:51:36.359|METHOD_ENTRY|[204]|ApexPages.StandardSetController.next()
18:51:36.359|EXCEPTION_THROWN|[EXTERNAL]|System.VisualforceException: Modified rows exist in the records collection!
18:51:36.360|METHOD_EXIT|[204]|ApexPages.StandardSetController.next()
18:51:36.360|CODE_UNIT_FINISHED|MyMarketController invoke(next)

It seems like this isn't working.  Back in April we had a thread going regarding exposing WebService classes via Sites to allow for public, non-authenticated webservices.

 

http://boards.developerforce.com/t5/Apex-Code-Development/SOAP-request-to-APEX-webservice-without-requiring-authentication/m-p/182108#M29174

 

In implementing this in one of our sandboxes, we keep getting the a soap fault message

 

sample request

 

 

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sel="http://soap.sforce.com/schemas/class/SelfServiceAPI">
   <soapenv:Body>
      <sel:insertTicket>
         <sel:email>test@test.com</sel:email>
         <sel:name>test user</sel:name>
         <sel:product>widgets</sel:product>
         <sel:subject>testing api ticket submit</sel:subject>
         <sel:description>testticketdescription</sel:description>
      </sel:insertTicket>
   </soapenv:Body>
</soapenv:Envelope>

 

 

and the response:

 

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sf="http://soap.sforce.com/2006/08/apex">
   <soapenv:Body>
      <soapenv:Fault>
         <faultcode>sf:INVALID_SESSION_ID</faultcode>
         <faultstring>INVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Illegal Session</faultstring>
      </soapenv:Fault>
   </soapenv:Body>
</soapenv:Envelope>

 

So here's the question (hopefully Bulent is reading :) ), can we get a working example (XML request and response) for using an Apex Web Service via Sites?  It would seem that the login() API call is a requirement no matter where the API call is targeted at, since that's the only way to get a session, so...how do you execute a login for a Sites guest user?

 

 

I've written a custom controller that exploits the StandardSetController class to return a page of records and allow pagination.

 

VF controller has three (relevant) methods:

 

getPage()  - returns List of records in current pageset (pagesize = 10)

previousPage() - executes the previous() method on the standard set controlller object

nextPage() - executes the next() method on the standard set controller object

 

The StandardSetController is constructed using a Database.getQueryLocator per the doc

 

setCtlr = new ApexPages.StandardSetController(

Database.getQueryLocator(

[Select id, name, Account__r.name from Foo__c where id in :fooIdSet]));

When I set up my APEX test method:

 

1.  Insert 11 rows into database  //works ok

2.  Assert that getPage() returns 10 rows  // assertion passes

3.  Execute nextPage() on the controller

4.  Assert that getPage() returns 1 row (the 11th)

 

Here's the problem: step #3 fails because VF comes back with:

 

System.VisualforceException: Modified rows exist in the records collection!

 

I checked the creation datetime and lastmodify datetime just prior to executing Step3 and all is OK, the records haven't mysteriously been changed underneath.

 

I get the same error (in a non-Sites test whilst logged in as admin and simply executing the VF page in the browser.

 

What would cause this error?

Message Edited by crop1645 on 04-08-2009 05:12 PM
Message Edited by crop1645 on 04-08-2009 05:14 PM