I know how to get FieldSet fields from within apex through describe. but I have the need to do it using javascript is this possible ? and if so how.

Thanks in advance Ronen


1 Answer 1


I gave this a shot using JSforce, let me know if this would be an acceptable approach in your case.


You can use login methods as shown here and get the access token,I went the VF route to avoid the login call and then get the access token approach.


I used Metdata api option to read the field set object.


  <apex:page docType="html-5.0" showHeader="false">
  <apex:includeScript value="{!URLFOR($Resource.jsforce)}" /> <!-- Static Resource or Direct Link Below -->
        var conn = new jsforce.Connection({ accessToken: '{!$Api.Session_Id}' });
        var fullNames = [ 'Account.prao6308__test_acc_fS' ];
        conn.metadata.read('FieldSet', fullNames, function(err, metadata) {

        if (err) { 

        console.log('Fieldset Label: '+ metadata.label);
        console.log('Fieldset Fullname: ' + metadata.fullName);
        for (var i=0; i < metadata.displayedFields.length; i++) {
            console.log("Field "+[i]+" inside field set: " + metadata.displayedFields[i].field);



enter image description here

  • Thank you very much , I didn't was familiar with this approach will give it a shot ! Thank you very much Nov 22, 2016 at 15:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .