Can you use exportData() in a snippet and export data from a table without the column headers?

Jeff Rutter
edited September 8, 2017 in Questions
I'm looking to provide end users with the ability to export data from a table to a .csv file without column headings (field name/labels). Is this possible with the current exportData() method?

Thanks - Jeff Rutter

Comments

  • Bill McCullough
    Bill McCullough 💎💎
    edited August 12, 2017
    Jeff,

    Jack Sanford posted an export snippet here-> https://community.skuid.com/skuid/topics/export_to_excel_without_a_table?topic-reply-list%5Bsettings...

    I modified his script and 'left out' the field labels.  Here is a sample page based on Tasks.
    <skuidpage unsavedchangeswarning="yes" personalizationmode="server" useviewportmeta="true" showsidebar="true" showheader="true" tabtooverride="Task">
        <models>
            <model id="Task" limit="100" query="true" createrowifnonefound="false" datasourcetype="salesforce" datasource="salesforce" sobject="Task">
                <fields>
                    <field id="Subject"/>
                    <field id="CreatedDate"/>
                </fields>
                <conditions/>
                <actions/>
            </model>
        </models>
        <components>
            <pagetitle model="Task" uniqueid="sk-3KScRx-83">
                <maintitle>
                    <template>{{Model.labelPlural}}</template>
                </maintitle>
                <subtitle>
                    <template>Home</template>
                </subtitle>
                <actions>
                    <action type="multi" label="Export Tasks" uniqueid="sk-3KSfkM-126">
                        <actions>
                            <action type="custom" snippet="exportSnippet"/>
                        </actions>
                    </action>
                    <action type="savecancel" uniqueid="sk-3KScRv-82"/>
                </actions>
            </pagetitle>
        </components>
        <resources>
            <labels/>
            <css/>
            <javascript>
                <jsitem location="inlinesnippet" name="exportSnippet" cachelocation="false">var $ = skuid.$;
                    
                    var today = new Date();
                    var model = skuid.model.getModel('Task');
                    
                    var fields = [
                    //use the api names of your fields here
                        'Subject',
                        'CreatedDate'    
                    ];
                    
                    var fieldsWithCorrectLabels = $.map(fields, function(v){
                        var actualField = model.getField(v);
                         console.log(actualField.id);
                         
                         return {
                            id: actualField.id,
                            name: actualField.name
                        };    
                    });
                    
                    model.exportData({
                        fileName: 'Custom Export File Name '+today+'.csv',
                        fields: fieldsWithCorrectLabels,
                        doNotAppendRowIdColumn: true
                        });</jsitem>
                </javascript>
            </resources>
            <styles>
                <styleitem type="background" bgtype="none"/>
            </styles>
        </skuidpage>
    Thanks,

    Bill

  • Germany3
    Germany3 🛠️ 

    Hey @JeffRutter !

    Skuid has implemented an easier way to export data as well as added other features and enhancements 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,

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!