web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Output a .CSV File using Javascript

(0) ShareShare
ReportReport
Posted on by

Hi All,

Simple question (hopefully) Is it possible to output a CSV file in Dynamics CRM Online using JavaScript?

The purpose is to retrieve data from the quote form and output it as a CSV file, I already getting the data needed. But now I'm just stuck on wherever or not I can actually output a file. I've done some digging around online and found there is a chance it would work however upon trying some it did not work.

Here is an example of one that did not work and have error 'Object doesn't support property or method 'join''

var data=[customerId.Name,description,effectiveFrom]
var csvContent = "data:text/csv;charset=utf-8,";
data.forEach(function(infoArray, index){
dataString = infoArray.join(",");
csvContent += index < data.length ? dataString+ "\n" : dataString;
});
var encodedUri = encodeURI(csvContent);
var link = document.createElement("a");
link.setAttribute("href", encodedUri);
link.setAttribute("download", "my_data.csv");
document.body.appendChild(link); // Required for FF
alert("Complete export to CSV");
link.click(); // This will download the data file named "my_data.csv".

Hopefully someone can help me.

*This post is locked for comments

I have the same question (0)
  • Schalky Profile Picture
    30 on at

    depends on what version of CRM you are using. If you are using above 2015 you will need to disable the new form rendering engine as it prevents you form editing the forms DOM.

  • Community Member Profile Picture
    on at

    Hi Schalky,

    I use CRM Online 2016.

    What you mean by disable the new form rendering engine? Sorry I quite new in CRM.

    Thanks & Best Regards,

    Noor Syazwana Mat Islan

  • Suggested answer
    Schalky Profile Picture
    30 on at

    Hi Noor

    You can enable the legacy rendering engine by following this. www.powerobjects.com/.../new-form-rendering-engine-in-dynamics-crm-2015

    Keep in mind it does this for your whole crm site. And removes the added performance of the new form rendering engine.

    As you have 2016 using the excel templates instead may accomplish what your trying to do. Or you can create a workflow and use some c# to perform the action if you wish to use the newer engine.

  • Community Member Profile Picture
    on at

    Hi Schalky,

    Actually the code I write above it work only at Chrome.

    How can I do a code for IE?

    Thanks & Best Regards,

    Noor Syazwana Mat Islan

  • Suggested answer
    ScottDurow Profile Picture
    21 on at

    The problem is not to do with turbo forms - it's because IE doesn't support the technique you are using.

    Use the code at http://jsfiddle.net/cr4gL29v/ to be cross browser.

    Taken from stackoverflow.com/.../how-to-export-javascript-array-info-to-csv-on-client-side

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans