Displaying the History related list for an object

I’d like to add the standard History (field tracking) related list to my Skuid detail page. In my particular use case, I’m working with a custom object. 1. I created a model which queries the History for the object in question and filtered it for the specific detail record. 2. I added a table and put the CreatedDate, CreatedBy, ChangedField, OldValue and NewValue fields in it. The challenge is that the “ChangedField” field doesn’t display at all. 3. So I created a custom field renderer (in-line snippet) to convert the value to TEXT: var field = arguments[0]; var value = arguments[1]; skuid.ui.fieldRenderers.TEXTfield.mode; Now, however, the column displays the API name of the field that was changed. I’d like to display the friendlier LABEL instead. Any ideas how to accomplish this?

9 times out of 10 when these scenarios occur it is caused by field level security in the base salesforce setup.  I just checked some customer work we are doing where we show contact history - and nothing fancy was required to show the the “Changed Field” value in a table. 

Let us know if you can’t get this working. 

Hi Jonathan, This is a known issue with Skuid, in fact, so you’re not alone in having this problem, and we’re quite impressed that you got as far as making a custom field renderer to get the API name to show. Well done! As of the latest released version of Skuid — 3.15 — the “ChangedField” field on Field History objects shows up blank for all changes to custom fields , but NOT for standard fields. So changes to a Contact’s FirstName, MailingStreet, etc. fields will all show up fine, as well as changes to a Custom Object’s Name field, but as soon as you try to show Field History on a Custom Field on either standard or custom objects, Skuid will show a blank for the “ChangedField” field. Why? Short answer, it’s due to some lameness in the picklist entry metadata Salesforce returns for the Field History object. As of Skuid 3.21+ (not released yet), we have fixed this so that the API name will always consistently show up. ******************** BUT none of this addresses your main question, as you’ve already figured out how to get the API name to show up. To show the friendlier LABEL of the field is in fact quite a bit trickier to achieve right now, because the Salesforce Schema data for the ChangedField field does not return the field labels to us, just the API names. So… we will add this as a Skuid bug to be resolved in an upcoming version. But in the meantime… Here’s how you can try to achieve this on your own using a custom field renderer. The basic task at hand is this: (1) Get the “friendly” Labels for all Fields that you’re tracking Field History for on this Object. (2) In your Custom Field renderer, display the friendly Label corresponding to the given Field API Name. To accomplish (1), you just need to have some Model on your Skuid Page that requests the field metadata for the Fields you’re tracking history for. More than likely, you’ve already got such a Model in your Skuid Page, since if you’re tracking history on these Fields, you probably are showing them somewhere on your page! (just a guess) But, if you don’t have such a Model yet, then you will need to create one — just for the purpose of retrieving Field Metadata. E.g. if your Object is Application__c, and you have Field History tracking enabled on the fields Name, Application_Status__c, and Application_Date__c etc., then you need to have some Model on your Skuid Page on the Application__c object that requests those 3 Fields, but this Model need not retrieve any data — in the Model’s Advanced properties, you can un-check the “Load Model data on page load” property so that Skuid will not try to load any data in the Model. But Skuid WILL still load in all Metadata for the requested Fields and for the Object — therefore getting you the Field Labels you need! For (2), you just need to to whatever Model is accomplishing (1) and grab the corresponding Field Labels. So here would be the new text of your custom field renderer for the ChangedField:

var field = arguments[0]; var value = skuid.utils.decodeHTML(arguments[1]); // Get the Model that has our Metadata var ModelWithLabels = skuid.model.getModel('ApplicationData'); // See if there is a Field in our Model whose API Name // is our value var fieldMetadata = ModelWithLabels.getField(value); if (fieldMetadata) { value = fieldMetadata.label; } skuid.ui.fieldRenderers.TEXT[field.mode](field,value); 

Thanks, that code worked.