Developer forum

Forum » CMS - Standard features » Delete form entries using Data Integration & Scheduled tasks

Delete form entries using Data Integration & Scheduled tasks

Sonni Tost
Reply

Hi all,

I have been told that it should be possible to perform deletions in Dynamicweb using the Data Integration module - however i cannot figure out how to do it.

I have some Forms for editors forms. The submitted content of these forms need to be deleted when the submitted data is more than 90 days old.

I need to perform two things:

1) I need to be able to delete data that is more than 90 days old.

2) I need to be able to call the data integration on a daily basis so i have to be able to call it with a parameter like todays date - 90 days. Can i do that with Dynamicweb's scheduled tasks?

The site is running on Dynamicweb 8.9.2.21.

Kind regards,

 

Sonni T.


Replies

 
Nicolai Pedersen
Reply

Hi Sonni

You can create a scheduled task of type "Add-in" and choose the "Run SQL add-in".

In there you can specify a SQL that deletes data from FormSubmitData and FormSubmit that is older than 90 days. Something like this (not tested):

DELETE FROM FormSubmitData WHERE FormSubmitDataSubmitID in (SELECT FormSubmitID FROM FormSubmit WHERE FormSubmitDate < dateadd(day, -90, getdate()))

See dump (From DW9 - same in DW8)

BR Nicolai

Capture.PNG
 
Sonni Tost
Reply

Hi Nicolai,

That sounds perfect! However i cannot see the Run SQL add-in-option.

I have a screen shot of the options that are available to me.

Kind regards

 

Sonni T.

ScheduledTaskMissingAddInOption.jpg
 
Nicolai Pedersen
Reply

Hm - can see that is a new DW9 feature.

Attached find the implementation - it is pretty simple, and if you compile it against Dynamicweb 8 assemblies and add it to your /bin, you can do the same.

BR Nicolai

 
Sonni Tost
Reply

Hi Nicolaj,

Thank you. I'll look into it :-)

Kind regards

 

Sonni T.

 

You must be logged in to post in the forum