Get field sets of an Object


I have defined field sets in a object, I use them in apex to on record creation get fields from other related objects and copy them into this object: 

Can I get the Field sets of this object in skuid?

I’m trying to do a “reset record” to get all this fields and copy them again, replacing all the modifications to the record that the users have done of the original data.

I have done it without the fieldsets, something like:

$.each( selectedItems,    function( i, item )
        var row = item.row;
        rowsToUpdate[ row.Id ] = { 
Total_Install_Charges_BC__c: row.Sales_Product__r.Total_Install_Charges_BC__c,
Total_Monthly_Charges_BC__c: row.Sales_Product__r.Total_Monthly_Charges_BC__c, […] (rest of all the fields to copy, more than 60 fields)

It’s working, the only problem is maintain the fields, every time I have to add or remove a field i have to edit the fieldset, go to the skuid snippet and remove/add the field form the rowsToUpdate.

So, If I can get the fieldsets from salesforce It will be easier to maintain.

There’s probably a way to get the filed name and value from the “row.Sales_Product__r” object. So you could probably do something like this:

$.each( selectedItems, function(i,item){&nbsp; &nbsp; var row = item.row;<br>var myVar = [];<br>//there should be a way to get at the field names, maybe&nbsp;<br>$.each(row.Sales_Product__r, function(j,field)){<br>//figure out how to get the field name and value from the loop var<br>myVar[] = field.value;<br>}<br>&nbsp; &nbsp; rowsToUpdate[row.Id] = myVar;<br>});

Hi Pablo,

Currently, we do not give you access to field sets from Skuid out of the box.  You would have to write an Apex remote action and use Javascript Remoting to get this information.

Field sets are not currently supported for display within components.  But your use case is very interesting. It does seem that the API should provide access to all the fields in a field set.  This makes sense.  We will add it to the list for consideration. 

Yes, but not all the fields of the “Sales product” are needed

I have recreated the Field sets as Javascript arrays, It’s easier to maintain…

Thanks rob.