Delete or stop scheduled email when item is deleted

Forums Dynamic Forms for SharePoint Delete or stop scheduled email when item is deleted

Viewing 4 reply threads
  • Author
    Posts
    • #34384
      Amal Vellappillil
      Participant

      Hi Alex,

      Is it possible to have scheduled emails (recurring and non recurring ones) to be stopped or deleted when the corresponding list item is deleted? Right now it looks like the scheduled emails still gets sent even if the list item is deleted.

      Any help is appreciated.

      Thank you,
      Amal Vellappillil

    • #34388
      Alexander Bautz
      Keymaster

      Hi,
      There is no built in support to handle this, but if you delete the item from within DispForm or EditForm you can clean up by adding this to your custom js:

      DeleteItemConfirmation = function(){
          spjs.modal.add({
              "title": "Delete item?",
              "html": "Please confirm that you want to delete this item.",
              "showClose": false,
              "allowMaximize": false,
              "resizable": false,
              "ok": function(){
                  spjs.dffs.getPendingEmails();
                  var idArr = [];
                  jQuery.each(spjs.dffs.data.thisItemPendingEmails, function(i, item){
                      idArr.push(item.ID);
                  });
                  if(idArr.length > 0){
                      spjs.utility.updateItem({ "listName": "DFFS_EMail", "listBaseUrl": spjs.dffs.data.dffs_email_baseUrl, "id": idArr, "data": { "Stop": "1" } });
                  }
                  var dRes = spjs.utility.deleteItem({ "listName": _spPageContextInfo.pageListId, "id": spjs.dffs.data.thisItemID});
                  if(dRes.success){
                      location.href = _spPageContextInfo.webServerRelativeUrl;
                  }
              },
              "cancel": function(){
                  // Close dlg
              }
          });    
      }
      

      Alexander

      • This reply was modified 2 weeks, 4 days ago by Alexander Bautz. Reason: Changed code snippet
    • #34393
      Amal Vellappillil
      Participant

      Hey thank you for the quick work around. This does work with some change in user usage.
      Is there a way to make this as a default on a site collection or site level? This would be great rather than going to each and every list and all its different forms and adding the snippet.

      Or is there a way to load another javascript file whenever DFFS loads? I know there is the “Load these files before executing the Custom JS” feature per list per form level. Wondering if there is a possibility to add something similar on a site or site collection level.

      • #34398
        Alexander Bautz
        Keymaster

        Hi,
        Yes, if you use DFFS installer v2 you can open the DFFS installer, click the first tab “Modify the loader file” and add this code snippet wrapped in a <script> tag in the “Custom JS” textarea and then hit the “Update loader file” button.

        Now all forms already installed with this installer will automatically load this snippet.

        Alexander

    • #34401
      Alexander Bautz
      Keymaster

      Hi,
      I changed the code snippet slightly by adding if(idArr.length > 0){…

      Alexander

    • #34446
      Amal Vellappillil
      Participant

      Thank you Alex. The suggested solution makes it much easier than adding the code snippet to each and every form.

Viewing 4 reply threads
  • You must be logged in to reply to this topic.