0

I am trying to fetch the list of objects using javascript. I am able to fetch the Account or Contact standard object but not WorkOrderLineItem object. What could be the reason for the same?

<script type="text/javascript" src="/soap/ajax/16.0/connection.js"></script>
<script type="text/javascript" src="/soap/ajax/16.0/apex.js"></script>

<script> 
    window.onload = function(){
        sforce.connection.sessionId = '{!$Api.Session_ID}';
        var agmtArray = sforce.connection.query("Select Id from WorkOrderLineItem limit 2");
        var records = agmtArray.getArray("records");
        alert('>>'+records);     
    }
</script>
  • 1
    Can you change the ajax version and try? Seems like you are using much older veriosn for the same.URL : developer.salesforce.com/docs/atlas.en-us.ajax.meta/ajax/… – Arabinda Sep 20 '19 at 11:10
  • I tried with 47.0 too but it did not work out for me. – Sukruti Sep 20 '19 at 11:11
  • Hey, I got it.. Thank you :) – Sukruti Sep 20 '19 at 11:14
  • Any error you are getting in browser console or any debug log? – Arabinda Sep 20 '19 at 11:15
  • No, I changed it to 46 version and it worked perfectly. – Sukruti Sep 20 '19 at 11:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.