How can I add one more link in export action dropdown?

Export Excel in WFFM reports

I have patched 'export form data to excel' link with instead and it is working fine with custom processor but I want to add one more link/button for this custom export.

<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:set="http://www.sitecore.net/xmlconfig/set/">
        <processor patch:instead="processor[@type='Sitecore.WFFM.Services.Pipelines.ExportToExcel.ExportFormDataToExcel, Sitecore.WFFM.Services']" type="Website.Shared.Pipeline.CustomExportToExcel, Website.Shared" />

1 Answer 1

  1. Login to Sitecore backend
  2. Switch DB to core
  3. Insert new item under /sitecore/client/Applications/WFFM/Resources/Parameters/ActionControl Parameters/ActionColumn/
  4. Add new item with call of your JavaScript function. E.g.: javascript:app.doSomething()
  5. Open \sitecore\shell\client\Applications\WFFM\Pages\FormReport\FormReport.js file and add function doSomething to it. You can call any action from any controller with any parameters from your Javascript function.
  6. Create new pipeline and processor for it
  7. Execute new pipeline inside your action in controller by CorePipeline.Run("doSomething", formExportArgs);

Here is for example disassembled code of default endpoint(action in WFFM controller). You can use it as example:

        public ActionResult Export(Guid id, int format)
            Assert.ArgumentNotNull(id, "id");
            Assert.ArgumentNotNull(format, "format");
            bool flag = format == 0;
            Item itemFromMasterDatabase = this.itemRepository.GetItemFromMasterDatabase(new ID(id));
            Assert.IsTrue(itemFromMasterDatabase != null, "Can't find the form.");
            Job job = Context.Job;
            if (job != null)
            IEnumerable<FormData> formData = this.FormsDataProvider.GetFormData(id);
            FormExportArgs formExportArgs = new FormExportArgs(this.itemRepository.CreateFormItem(itemFromMasterDatabase), new FormPacket(formData), this.webUtil.GetTempFileName(), flag ? "text/xml" : "application/vnd.ms-excel");
            formExportArgs.Parameters.Add("contextUser", Context.User.Name);
            CorePipeline.Run(flag ? "exportToXml" : "exportToExcel", formExportArgs);
            return base.Json(new
                File = formExportArgs.FileName
            }, JsonRequestBehavior.AllowGet);
  • P.S. Let me know if you need more details on any of steps.
    – Anton
    Commented May 3, 2018 at 16:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.