function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
manoharpmanoharp 

Rest API - 'No profiling information'

|[17]|MAP<String,String>.get(Object)
23:12:36.034 (34396000)|SYSTEM_METHOD_EXIT|[17]|MAP<String,String>.get(Object)
23:12:36.034 (34406000)|VARIABLE_SCOPE_BEGIN|[17]|q_fulfillment|String|false|false
23:12:36.034 (34415000)|VARIABLE_ASSIGNMENT|[17]|q_fulfillment|null
23:12:36.034 (34419000)|STATEMENT_EXECUTE|[19]
23:12:36.034 (34422000)|STATEMENT_EXECUTE|[20]
23:12:36.034 (34425000)|STATEMENT_EXECUTE|[22]
23:12:36.034 (34427000)|LIMIT_USAGE|[22]|SCRIPT_STATEMENTS|13|200000
23:12:36.034 (34433000)|HEAP_ALLOCATE|[22]|Bytes:81
23:12:36.034 (34444000)|HEAP_ALLOCATE|[22]|Bytes:4
23:12:36.034 (34455000)|HEAP_ALLOCATE|[22]|Bytes:7
23:12:36.043 (43288000)|SOQL_EXECUTE_BEGIN|[22]|Aggregations:0|select Id, Email, FirstName, LastName from Contact where Email = :tmpVar1 limit 1
23:12:36.043 (43302000)|LIMIT_USAGE|[22]|SOQL|1|100
23:12:36.043 (43306000)|LIMIT_USAGE|[22]|AGGS|0|300
23:12:36.049 (49713000)|SOQL_EXECUTE_END|[22]|Rows:1
23:12:36.049 (49730000)|LIMIT_USAGE|[22]|SOQL_ROWS|1|50000
23:12:36.049 (49745000)|HEAP_ALLOCATE|[22]|Bytes:8
23:12:36.049 (49765000)|HEAP_ALLOCATE|[22]|Bytes:103
23:12:36.049 (49937000)|HEAP_ALLOCATE|[22]|Bytes:8
23:12:36.049 (49958000)|HEAP_ALLOCATE|[22]|Bytes:33
23:12:36.050 (50034000)|HEAP_ALLOCATE|[22]|Bytes:20
23:12:36.050 (50049000)|VARIABLE_SCOPE_BEGIN|[22]|attendee|Contact|true|false
23:12:36.050 (50090000)|VARIABLE_ASSIGNMENT|[22]|attendee|{"serId":1,"value":{"Email":"hucas.m@e (13 more) ...","FirstName":"hucas","Id":"003K000000dWxT3IAK","LastName":"M"}}|0x11362c1f
23:12:36.050 (50099000)|STATEMENT_EXECUTE|[23]
23:12:36.050 (50103000)|LIMIT_USAGE|[23]|SCRIPT_STATEMENTS|14|200000
23:12:36.050 (50109000)|HEAP_ALLOCATE|[23]|Bytes:47
23:12:36.050 (50120000)|HEAP_ALLOCATE|[23]|Bytes:4
23:12:36.052 (52617000)|SOQL_EXECUTE_BEGIN|[23]|Aggregations:0|select Id from User where Id = :tmpVar1 limit 1
23:12:36.052 (52630000)|LIMIT_USAGE|[23]|SOQL|2|100
23:12:36.052 (52635000)|LIMIT_USAGE|[23]|AGGS|0|300
23:12:36.054 (54488000)|SOQL_EXECUTE_END|[23]|Rows:0
23:12:36.054 (54504000)|LIMIT_USAGE|[23]|SOQL_ROWS|1|50000
23:12:36.054 (54516000)|HEAP_ALLOCATE|[23]|Bytes:4
23:12:36.054 (54526000)|HEAP_ALLOCATE|[23]|Bytes:0
23:12:36.054 (54604000)|HEAP_ALLOCATE|[23]|Bytes:4
23:12:36.054 (54617000)|HEAP_ALLOCATE|[23]|Bytes:30
23:12:36.054 (54708000)|HEAP_ALLOCATE|[23]|Bytes:46
23:12:36.054 (54745000)|VARIABLE_SCOPE_BEGIN|[56]|e|Exception|true|false
23:12:36.055 (55004000)|VARIABLE_ASSIGNMENT|[56]|e|"common.apex.runtime.impl.ExecutionException: List has no rows for assignment to SObject"|0x2e5f1556
23:12:36.055 (55017000)|STATEMENT_EXECUTE|[56]
23:12:36.055 (55021000)|STATEMENT_EXECUTE|[57]
23:12:36.055 (55024000)|LIMIT_USAGE|[57]|SCRIPT_STATEMENTS|15|200000
23:12:36.055 (55031000)|HEAP_ALLOCATE|[57]|Bytes:5
23:12:36.664 (56368000)|CUMULATIVE_LIMIT_USAGE
23:12:36.664|LIMIT_USAGE_FOR_NS|(default)|
  Number of SOQL queries: 2 out of 100
  Number of query rows: 1 out of 50000
  Number of SOSL queries: 0 out of 20
  Number of DML statements: 0 out of 150
  Number of DML rows: 0 out of 10000
  Number of code statements: 15 out of 200000
  Maximum heap size: 0 out of 6000000
  Number of callouts: 0 out of 10
  Number of Email Invocations: 0 out of 10
  Number of fields describes: 0 out of 100
  Number of record type describes: 0 out of 100
  Number of child relationships describes: 0 out of 100
  Number of picklist describes: 0 out of 100
  Number of future calls: 0 out of 10

23:12:36.664|TOTAL_EMAIL_RECIPIENTS_QUEUED|0
23:12:36.664|STATIC_VARIABLE_LIST|
  double:MIN_NORMAL:0
  double:POSITIVE_INFINITY:0
  long:serialVersionUID:0
  Boolean:TRUE:0
  double:MIN_VALUE:0
  int:SIZE:0
  int[]:sizeTable:0
  char[]:DigitOnes:0
  char[]:DigitTens:0
  double:NaN:0
  String:_sfdcAdditionalTypeInfo:0
  String:_sfdcAdditionalCodeLocations:0
  String:_sfdcAdditionalTypeInfo:0
  String:_sfdcAdditionalTypeInfo:0
  double:NEGATIVE_INFINITY:0
  int:MIN_VALUE:0
  int:SIZE:0
  String:_sfdcAdditionalCodeLocations:0
  String:_sfdcAdditionalCodeLocations:0
  double:MAX_VALUE:0
  long:serialVersionUID:0
  int:MAX_EXPONENT:0
  int:MIN_EXPONENT:0
  String:_sfdcAdditionalCodeLocations:0
  Boolean:FALSE:0
  int:MAX_VALUE:0
  char[]:digits:0
  long:serialVersionUID:0

23:12:36.664|CUMULATIVE_LIMIT_USAGE_END

23:12:36.670|CUMULATIVE_PROFILING_BEGIN
23:12:36.670|CUMULATIVE_PROFILING|SOQL operations|
Class.TTradeService.doGet: line 22, column 1: [ SELECT Id, Email, FirstName, LastName FROM Contact WHERE Email = :attendee_email LIMIT 1]: executed 1 time in 15 ms
Class.TTradeService.doGet: line 23, column 1: [SELECT Id FROM User WHERE Id = :customField1 LIMIT 1]: executed 1 time in 4 ms

23:12:36.670|CUMULATIVE_PROFILING|No profiling information for SOSL operations
23:12:36.670|CUMULATIVE_PROFILING|No profiling information for DML operations
23:12:36.670|CUMULATIVE_PROFILING|method invocations|External entry point: global static String doGet(): executed 1 time in 22 ms
Class.TTradeService.doGet: line 7, column 1: global String __sfdc_remoteAddress(): executed 1 time in 0 ms
Class.TTradeService.doGet: line 8, column 1: global Blob __sfdc_requestBody(): executed 1 time in 0 ms
Class.TTradeService.doGet: line 9, column 1: global String __sfdc_requestURI(): executed 2 times in 0 ms
Class.TTradeService.doGet: line 10, column 1: global MAP<String,String> __sfdc_params(): executed 1 time in 0 ms
Class.TTradeService.doGet: line 12, column 1: global MAP<String,String> __sfdc_params(): executed 2 times in 0 ms
Class.TTradeService.doGet: line 13, column 1: global MAP<String,String> __sfdc_params(): executed 2 times in 0 ms
Class.TTradeService.doGet: line 14, column 1: global MAP<String,String> __sfdc_params(): executed 2 times in 0 ms
Class.TTradeService.doGet: line 15, column 1: global MAP<String,String> __sfdc_params(): executed 2 times in 0 ms
Class.TTradeService.doGet: line 17, column 1: global MAP<String,String> __sfdc_params(): executed 2 times in 0 ms
Class.TTradeService.doGet: line 16, column 1: global MAP<String,String> __sfdc_params(): executed 2 times in 0 ms

23:12:36.670|CUMULATIVE_PROFILING_END
23:12:36.056 (56571000)|CODE_UNIT_FINISHED|TTradeService.doGet
23:12:36.056 (56583000)|EXECUTION_FINISHED
@RestResource(urlMapping='/ttradeservice')
global class TTradeService {
    @HttpGet
    global static string doGet() {
        RestRequest req = RestContext.request;
        RestResponse res = RestContext.response;
        String remoteAdd = RestContext.request.remoteAddress;
        Blob reqBody = RestContext.request.requestBody;
        String answerId = req.requestURI.substring(req.requestURI.lastIndexOf('/')+1);
         Map <String, String> reqParams = RestContext.request.params;
     
        String first_name = RestContext.request.params.get('attendee_person_firstName');
        String last_Name = RestContext.request.params.get('attendee_person_lastName');
        String customField0 = RestContext.request.params.get('attendee_customField0');
        String attendee_email = RestContext.request.params.get('attendee_email');
        String customField1 = RestContext.request.params.get('attendee_customField1');
        String q_fulfillment = RestContext.request.params.get('questionId__fulfillment');

        try 
        { 
            Contact attendee = [ SELECT Id, Email, FirstName, LastName FROM Contact WHERE Email = :attendee_email LIMIT 1];
            User CSA = [SELECT Id FROM User WHERE Id = :customField1 LIMIT 1];
            List<ts2__Assessment__c> assmnts = [SELECT ts2__User__c, TimeTrade_Event_ID__c, Location__c, Campus__c, Appointment_Type__c,Date__c,Details__c,End_Time__c,Start_Time__c,ts2__Contact__c FROM ts2__Assessment__c WHERE Id = :attendee.Id LIMIT 1];
            
            if (assmnts.size() > 0)
            {
                return 'no error1';
            }
            else if (attendee.Id != '' ) 
            {         
                ts2__Assessment__c newassmnt = new ts2__Assessment__c();
                
                newassmnt.ts2__Contact__c = customField0 ;
        //        newassmnt.Appointment_Type__c = 
        //        newassmnt.Date__c = 
        //        newassmnt.Start_Time__c = 
        //        newassmnt.End_Time__c = 
        //        newassmnt.Details__c = 
        //        newassmnt.TimeTrade_Event_ID__c = 
        //        newassmnt.Location__c = 
        //        newassmnt.Campus__c = 
                newassmnt.ts2__User__c = CSA.Id;
                insert newassmnt;
                return 'no error2';
            }
            
            else
            {
               return 'Hello '+first_name;
            }
        } 
        catch (exception e) 
        {
            return 'error';
        }
    }
}

 Hi there,

 

Can someone help me to debug the issue here?

 

I am trying to build rest API process. where the thirdparty application is trying to some info into our org with out authenitcation. I have exposed the apex class using public access setting on a force.com site and calling this class through that.

 

I can see that I can do a proper handshake but I get 'error' from the exception. May I know whats causing it to avoid try section of the code?

 

Thank you,

Manohar

Best Answer chosen by Admin (Salesforce Developers) 
vbsvbs

Manohar - The log clearly mentions that there has been an exception for your SOQL on the User object and it does not return any rows. 

 

23:12:36.055 (55004000)|VARIABLE_ASSIGNMENT|[56]|e|"common.apex.runtime.impl.ExecutionException: List has no rows for assignment to SObject"|0x2e5f1556

 

This will be raising an exception and hence entering the genral exception block. In the future, raise exceptions from your Rest methods so that the client application can read the response JSON error message and act accordingly. 

All Answers

vbsvbs

Manohar - The log clearly mentions that there has been an exception for your SOQL on the User object and it does not return any rows. 

 

23:12:36.055 (55004000)|VARIABLE_ASSIGNMENT|[56]|e|"common.apex.runtime.impl.ExecutionException: List has no rows for assignment to SObject"|0x2e5f1556

 

This will be raising an exception and hence entering the genral exception block. In the future, raise exceptions from your Rest methods so that the client application can read the response JSON error message and act accordingly. 

This was selected as the best answer
ManoharSFManoharSF
thanks for pointing out