Export to Excel without a table

Ryan, the export process by default exports BOTH the lookup record’s Id and Name. You can circumvent this by only requesting the Name field in your export, e.g. using the example above / in the docs, request model.getField(‘User__r.Name’) and model.getField(‘Account__r.Name’) rather than model.getField(‘User__c’):

var model = skuid.model.getModel(‘MyModel’);
model.exportData({
    fileName: ‘MyFile’,
    fields: [
        model.getField(‘Name’),
        model.getField(‘User__r.Name’),
        model.getField(‘Account__r.Name’)
    ]
});

Yes Ross this is possible, just set the parameter doNotAppendRowIdColumn: true when calling exportData(), see the docs on exportData() for more information.

Thanks Zach. For some reason mine is just exporting the lookup ids though. I will try the other method. 

Perfect!  Thanks so much Rob.

Thank you, this is exactly what I was looking for!

Has anyone made any custom export field “Picker” that would allow the end user to choose what fields from the model to export?

My users are asking for a way to export the table data but choose different fields depending on the scenario. Any ideas I can run with let me know.

This post is extremely helpful! Thanks all…

Just thinking out loud here, but maybe you could do a a whole slew of UI-only fields that are checkboxes, that have the same API name of the fields you want. I think you’d want to have a model that has no fields except these UI-Only fields. 

Then in the JavaScript, if there’s some way to “get all the fields in this model”, you could iterate through the fields. I’m not at all a JS developer, but here’s the kind of code I would try, after getting all the fields in a given model in an array called modelFields (not even sure THAT is possible)

 fields: [ $.each(modelFields, function(){ var currentFieldName= this.Name; model.getField('currentFieldName') } ]

When did “Export Columns” become an option!? Or have I been overlooking it this whole time? That’s a great feature!

So many features,  so little time!   Glad you like them.   I believe export columns was a Superbank thing. 

Hi Zach,

I also used :

var model = skuid.model.getModel(‘LeadData’);

model.exportData({<br> fileName: 'MyFile',<br> additionalConditions: [<br> { field: "IsConverted", value: false, operator: '=' }<br> ]<br> }); That code for export. That export work perectly when i am doing testing inside salesforce. But once i use that same page in Force.com Site then its redirecting me on <b>/apex/ExportData page. Can you please let me know how can we do export in force.com site using a custom button. Thanks, Rajendra</b>

Hi Zach,

I got it answer here:

Before you can reliably use the skuid:page Visualforce (VF) component approach, there is a post-install configuration step you will need to take to guarantee that your Skuid Pages will behave exactly the same as they would if you were taking the Redirect approach:

You must find the following 3 VF Pages that come in the Skuid app / managed package, and create a local clone of each of them with the exact same name:

  1. ExportData
  2. UploadImage
  3. Include
http://help.skuidify.com/m/page-assignments-and-overrides/l/201793-using-the-skuid-page-visualforce-component-to-run-skuid-pages

Thanks,
Rajendra

is there a way to implement the “Attempt to Load in All Records Before Export” check box while using exportData()?

Matt,

Check out->  loadAllRemainingRecords

https://docs.skuid.com/latest/en/skuid/api/skuid_model_model.html

Thanks,

Bill

Thank you! I don’t know how I missed that in the documentation.

Is there a way to export a list of the conditions on a model and indicate which are activated and deactivated? 

Separate question, is there a way in the javascript exportData to give an alternate name to the fields you are exporting, the way there is in the export options on the table?

+1 - This would be very helpful.

Brayden, you can do this by override field metadata on the model and giving your fields new labels. I use this code to get at the field labels, but I’m not sure it’s necessary any more, they’ve fixed some things in the export code. 


var $ = skuid.$;<br>var today = new Date();<br>var model = skuid.model.getModel('YourModelName'); <br>var fields = [ //use the api names of your fields here<br>&nbsp; &nbsp; 'Index',<br>&nbsp; &nbsp; 'Id',<br>&nbsp; &nbsp; 'Name',&nbsp;<br>&nbsp; &nbsp; 'CustomField__c'&nbsp; &nbsp;&nbsp;<br>]; <br>var fieldsWithCorrectLabels = $.map(fields, function(v){<br>&nbsp; &nbsp; var actualField = model.getField(v);<br>&nbsp; &nbsp; &nbsp;console.log(actualField.id);<br>&nbsp; &nbsp; &nbsp;<br>&nbsp; &nbsp; &nbsp;return {<br>&nbsp; &nbsp; &nbsp; &nbsp; id: actualField.id,<br>&nbsp; &nbsp; &nbsp; &nbsp; name: actualField.name,<br>&nbsp; &nbsp; &nbsp; &nbsp; label: actualField.label<br>&nbsp; &nbsp; };&nbsp;&nbsp; &nbsp;<br>}); <br>model.exportData({<br>&nbsp; &nbsp; fileName: 'Custom Export File Name '+today,<br>&nbsp; &nbsp; fields: fieldsWithCorrectLabels,<br>&nbsp; &nbsp; doNotAppendRowIdColumn: true,<br>&nbsp; &nbsp; useAPINamesForHeaders: false<br>&nbsp; &nbsp; });



H/T to skuid support for unofficially helping with this

Note: “Index” is a UI-Only field I made with the formula {{index}}, which gives you the row number in a column.

Hey @Greg_Huete !

In case you missed it, Skuid has implemented an easier way to export data in the new Chicago release which is now available on the Skuid Releases page. Best practices for upgrading can be found in Upgrading Skuid on Salesforce. As a reminder, Salesforce does NOT allow reverting back to prior versions of managed packages. Skuid always recommends installing new versions in a non-business critical sandbox environment to test all mission-critical functionality before installing into a production environment.

We also recommend that you update out-of-date themes and design systems after you upgrade. Please let us know if you continue to encounter any problems with this issue after upgrading.

Thanks,