How to download a text file from CRM
Hello there!
I was wondering if there's a relatively easy way to generate and download a simple text file from CRM? Basically, I've got a query that returns a JSON text field and I'd like to make it easy for certain users to download that text file.
Thanks!
Rick
Answers
-
Hey Rick,
We've accomplished this in two different ways. The first and easiest way is if you have blackbaud's "auto file download" process (which I believe is not an out of the box feature), you can supply your query as an export to it and in the filename parameter you can literally add .txt to the end of the file name.
The second way is I found with a bit of digging the process that blackbaud uses to download as csv or xlsx can be used as a clr action on a data list for example. The script is here -
browser/htmlforms/platform/businessprocess/BusinessProcessExportAction.js
and there is actually a parameter you can set called ExportFormat. So if you have a datalist of queries/exports you want to export you can do something like this, just making sure your datalist pulls all the parameters as well.
Action -
<Action ID="00000000-0000-0000-0000-000000000000" Caption="Download as txt" ImageKey="RES:save"> <ExecuteCLRAction xmlns="bb_appfx_commontypes"> <ScriptIdentifier Url="browser/htmlforms/platform/businessprocess/BusinessProcessExportAction.js" ObjectName="BBUI.customactions.platform.BusinessProcessExportAction"> <StaticParameters> <ParameterList> <Param ID="TableKey"> <Value>Output</Value> </Param> <Param ID="RecordIDField"> <Value>BUSINESSPROCESSSTATUSID</Value> </Param> <Param ID="EnableActionFieldID"> <Value>ENABLEDOWNLOAD</Value> </Param> <Param ID="ParameterSetIDField"> <Value>PARAMETERSETIDFIELD</Value> </Param> <Param ID="BusinessProcessCatalogIDField"> <Value>BUSINESSPROCESSCATALOGID</Value> </Param> <Param ID="ProcessNameIdField"> <Value>NAME</Value> </Param> <Param ID="ExportFormat"> <Value>txt</Value> </Param> </ParameterList> </StaticParameters> </ScriptIdentifier> <ActionContext> <SectionField>ID</SectionField> </ActionContext> </ExecuteCLRAction> </Action>Data list to get parameters -
select ep.ID ,ep.DESCRIPTION ,case when ahq.ID is not null then 'Ad-hoc query' when sqi.ID is not null then 'Smart query instance' else 'Export definition' end as EXPORTTYPE ,case when ahq.NAME is null then case when sqi.NAME is null then ir.NAME else sqi.NAME end else ahq.NAME end as QUERYSELECTION ,ed.NAME as EXPORTDEFINITION ,bps.STARTEDON as LASTRUNDATE ,cast(bps.ENDEDON - bps.STARTEDON as time) as LASTRUNDURATION ,case when au.DISPLAYNAME = '' then au.USERNAME else DISPLAYNAME end as LASTRUNBY_USERNAME ,bps.NUMBERPROCESSED as LASTRUNRESULTCOUNT ,isnull(bps.STATUS, 'Not started') as LASTRUNSTATUS ,bpi.OWNERID as OWNERID ,coalesce(s.NAME, 'All sites') as SITES ,ep.SMARTQUERYINSTANCEID ,ep.ADHOCQUERYID -- Parameters needed for exporting ,bps.ID as BUSINESSPROCESSSTATUSID ,1 as ENABLEDOWNLOAD ,bpi.BUSINESSPROCESSPARAMETERSETID as PARAMETERSETIDFIELD ,ep.NAME ,bpi.BUSINESSPROCESSCATALOGID from EXPORTPROCESS ep left join ADHOCQUERY ahq on ep.ADHOCQUERYID = ahq.ID left join IDSETREGISTERADHOCQUERY ira on ep.ADHOCQUERYID = ira.ADHOCQUERYID left join SMARTQUERYINSTANCE sqi on ep.SMARTQUERYINSTANCEID = sqi.ID left join IDSETREGISTERSMARTQUERYINSTANCE irs on ep.SMARTQUERYINSTANCEID = irs.SMARTQUERYINSTANCEID left join BUSINESSPROCESSINSTANCE bpi on ep.ID = bpi.BUSINESSPROCESSPARAMETERSETID left join SITE s on s.ID = bpi.SITEID left join EXPORTDEFINITION ed on ed.ID = ep.EXPORTDEFINITIONID left join IDSETREGISTER ir on ir.ID = ep.SELECTIONID left join IDSETREGISTERADHOCQUERY ira2 on ir.ID = ira2.IDSETREGISTERID left join IDSETREGISTERSMARTQUERYINSTANCE irs2 on ir.ID = irs2.IDSETREGISTERID -- Gets the most recent run outer apply ( select top 1 ID ,STARTEDON ,STATUS ,STARTEDBYUSERID ,ENDEDON ,NUMBERPROCESSED ,BUSINESSPROCESSPARAMETERSETID from BUSINESSPROCESSSTATUS bps where bps.BUSINESSPROCESSPARAMETERSETID = bpi.BUSINESSPROCESSPARAMETERSETID order by STARTEDON desc ) as bps left join APPUSER au on au.ID = bps.STARTEDBYUSERID where -- Use this to limit to the queries you want sqi.FOLDERID = '' or ahq.FOLDERID = ''0
Categories
- All Categories
- New SKY Community TEST
- New Grantmaking TEST Community
- New Altru Test Community
- New bbcon Community - TEST
- 12 Blackbaud Agents for Good™
- New Raiser's Edge NXT Community
- 7 Blackbaud Community Help
- 218 bbcon®
- 1.4K Blackbaud Altru®
- 409 Blackbaud Award Management™ and Blackbaud Stewardship Management™
- 1.2K Blackbaud CRM™ and Blackbaud Internet Solutions™
- 16 donorCentrics®
- 361 Blackbaud eTapestry®
- 2.7K Blackbaud Financial Edge NXT®
- 680 Blackbaud Grantmaking™
- 597 Blackbaud Education Management Solutions for Higher Education
- 3.3K Blackbaud Education Management Solutions for K-12 Schools
- 952 Blackbaud Luminate Online® and Blackbaud TeamRaiser®
- 85 JustGiving® from Blackbaud®
- 7K Blackbaud Raiser's Edge NXT®
- 3.9K SKY Developer
- 255 ResearchPoint™
- 122 Blackbaud Tuition Management™
- 165 Organizational Best Practices
- 246 Member Lounge (Just for Fun)
- 40 Blackbaud Community Challenges
- 37 PowerUp Challenges
- 3 (Closed) PowerUp Challenge: Grid View Batch
- 3 (Closed) PowerUp Challenge: Chat for Blackbaud AI
- 3 (Closed) PowerUp Challenge: Data Health
- 3 (Closed) Raiser's Edge NXT PowerUp Challenge: Product Update Briefing
- 3 (Closed) Raiser's Edge NXT PowerUp Challenge: Standard Reports+
- 3 (Closed) Raiser's Edge NXT PowerUp Challenge: Email Marketing
- 3 (Closed) Raiser's Edge NXT PowerUp Challenge: Gift Management
- 4 (Closed) Raiser's Edge NXT PowerUp Challenge: Event Management
- 3 (Closed) Raiser's Edge NXT PowerUp Challenge: Home Page
- 4 (Closed) Raiser's Edge NXT PowerUp Challenge: Standard Reports
- 4 (Closed) Raiser's Edge NXT PowerUp Challenge: Query
- 822 Community News
- 3.1K Jobs Board
- 57 Blackbaud SKY® Reporting Announcements
- 47 Blackbaud CRM Higher Ed Product Advisory Group (HE PAG)
- 19 Blackbaud CRM Product Advisory Group (BBCRM PAG)
