function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Jeff BloomerJeff Bloomer 

Trigger to Create an Excel Attachment of Data In Object

Before I even start spinning my wheels, is it reasonable to assume that I can create a trigger that would create an attachment for an object after it's been created that contains an Excel file with the data that was just populated within it?


I've been told that if I can conceive of it, then it's most likely possible.  Also, if there is something similar out there that someone has already done, I would be greatly appreciative if you could point me down that path.


Thanks in advance!


An xls file is a binary format so it would likely not be possible to create.  However, xlsx is XML based and you could probably create one of those if you were determined enough.  I would recommend you just make a CSV as this is much simpler and can still be opened in Excel.

Jeff BloomerJeff Bloomer

Yes, you're right about .csv; that's actually more along the lines of what I was thinking.  The process I would expect is that I'd just have the trigger run a SOQL query following the creation of the object and place the .csv file as an attachment to it afterward.  Sound right?

Anyway, if something similar has already been done by someone out there, it would be nice to not have to do this completely from scratch.  :-)