Skip to main content

Hi,

 

I have a Smartobject as follows:

 

File               GroupID

 

hello.txt      1

Tester.txt    2

K2.docx     2

K9.docx     2

 

I am using a K2 Studio Workflow to send these files via email, but then i want to delete them afterwards as they just take up space in the tables, especially because they are datatype: file

 

So i did a Smartobjetc method - Delete on the Smartobject in the workflow (after sending email), but it only deletes the last record which matches the GroupID

in the above example, it deletes k9.docx, but leaves the other two documents with the same Group ID

 

How can i do a loop to delete all records that match that GroupID?

 

Thanks

Hi Sharpharp1


 


You could possibly make use of a For Each loop in your workflow.


 


See the following documentation for more info: https://help.k2.com/onlinehelp/K2smartforms/UserGuide/4.7/default.htm#Thin_Client_Wizards/General_Wizards/For_Each/For_Each.htm


 


Please just be careful when using a For Each. If it does not break out of the loop correctly, the workflow can get stuck in an infinite loop.


 


Cheers,


T


Tried that already, but i get this error:

 

"String was not recognized as a valid Boolean."


What backend system do you use? Can't you create an extra method? (Separate stored procedure delete if you use sql)

Something like

Delete from where groupid=@groupid

Hi MDen,

 

The backend is just the standard Smartbox Smartobject.

 

I could setup SSIS SQL jobs to delete the data, but this should surely be doable in K2.


Reply