Home › Forums › Classic DFFS › Delete or stop scheduled email when item is deleted
- This topic has 5 replies, 2 voices, and was last updated 3 years, 2 months ago by Amal Vellappillil.
-
AuthorPosts
-
-
September 1, 2021 at 20:04 #34384
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 -
September 1, 2021 at 21:18 #34388
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 3 years, 2 months ago by Alexander Bautz. Reason: Changed code snippet
-
September 2, 2021 at 18:52 #34393
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.
- This reply was modified 3 years, 2 months ago by Amal Vellappillil.
-
September 3, 2021 at 15:18 #34398
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
-
September 3, 2021 at 15:25 #34401
Hi,
I changed the code snippet slightly by adding if(idArr.length > 0){…Alexander
-
September 8, 2021 at 18:57 #34446
Thank you Alex. The suggested solution makes it much easier than adding the code snippet to each and every form.
-
-
AuthorPosts
- You must be logged in to reply to this topic.