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
vasu takasivasu takasi 

How to list of custom objects through ajax

hi i want get a list of custom objects through ajax ,

How can i achieve this? Please guide me.

 

<script src="/soap/ajax/18.0/connection.js"></script>
    <script type="text/javascript">
        sforce.connection.sessionId = "{!$Api.Session_ID}";
        window.onload=allobjects;
        function allobjects()
        {         
            var allobjects=sforce.connection.Schema.getGlobalDescribe().Values();
            alert(allobjects);

}

}

<select id="myobjs" >
        <option value="none">--None--</option>
    </select><br/>

Best Answer chosen by Admin (Salesforce Developers) 
Prafull G.Prafull G.

Use the following:

 

var result = sforce.connection.describeGlobal();
var sobjects = result.getArray("sobjects");
for (var i=0; i<sobjects.length; i++) {
    alert(sobjects[i].name);
}

 

Thanks,

P

All Answers

AdminBoosterAdminBooster

Hi,

 

Try using this call:

DescribeSObjectResult=sforce.connection.describeGlobal();

 

Regards,

JL

Prafull G.Prafull G.

Use the following:

 

var result = sforce.connection.describeGlobal();
var sobjects = result.getArray("sobjects");
for (var i=0; i<sobjects.length; i++) {
    alert(sobjects[i].name);
}

 

Thanks,

P

This was selected as the best answer