TeamDesk Knowledge Base & Support

   Home      FAQ      Forum      Idea Exchange      Ask a Question      My Stuff      Help   
Workflow action to delete a record
I would be good to have a workflow action 'Delete a Record'. Currently there are update and create record actions available. I have a situation where I want delete certain records based on the work flow actions.

Joseph Kurian
Date Created
1/6/2020 11:40:48 AM
Date Updated
2/21/2020 11:25:16 AM
Promoted By
Nacho Alvarez de ToledoNick AshcroftJacques du Plessis
Philipp Matuschka (MMB)cooper collier Patricio Bustos
Dale OliverJoseph Kurian
Philipp Matuschka (MMB) 1/6/2020 1:14:05 PM
I am in agreement, but I can also see how a Trigger which "runs away" could be very dangerous.
Joseph Kurian 1/6/2020 2:53:36 PM
With proper filter we can control the trigger.
MYCS Support 1/7/2020 4:11:19 AM
You could use api functionality in your workflow actions.

I use record change triggers to create and update records and then in certain scenarios delete
Philipp Matuschka (MMB) 1/7/2020 5:50:22 AM
A workaround I use is to
- have a flag which notes a record as "ready to delete" or similar.
- Set this with a record update action
- In view permissions for regualr Roles exclude these records
- In view for the admin Role, leave these records as visible and periodacally delete them manually
- Have a weekly email subscription which tells me which ones need deleting

Another possibilty, which I have not yet tried in triggers is
URLRoot() & "/delete.aspx?t=" & TableId() & "&ids=" & RecordId() & "&back=" & BackURL())
deletes a record. I use this in Formula URL fields to Delete a record in one table from a Button on another table
Joseph Kurian 1/7/2020 9:31:08 AM
I prefer to URL approach (even the Teamdesk Staff suggested the URL approach), I do not want to deal with the manual deletion. I can do api calls from my back end process to delete records. That works fine. I can automate that process too. But I prefer to have it in the TeamDesk database/application itself that functionality.
Philipp Matuschka (MMB) 1/7/2020 11:53:34 AM
" But I prefer to have it in the TeamDesk database/application itself that functionality."
Agreed which is why I promoted it
Anton Avguchenko 1/14/2020 3:10:54 PM
Two ways you could do this.
1. Ask yourself, do I really need to delete this record? Or will it be sufficient to make it Status 'VOID' and exclude records with that status from your views or maybe even at record access level.
2. If you really really need to delete the record, you can achieve this with a Call URL action to teamdesk API (which does have a delete method).
Philipp Matuschka (MMB) 2/14/2020 4:35:14 AM
Has anyone got an example of the Call URL Action to do this?
Philipp Matuschka (MMB) 2/14/2020 4:39:19 AM
... to do this on a record set
Nick Ashcroft 2/14/2020 5:52:24 AM
Hi Phillip
I have a 1-many relationship between 2 tables - document and document_relations. When a document (parent) is deleted, I want to delete all (child) document relations.

I dont know your use-case, but hopefully this can help get you started.

In the 'document' table I have a summary column which is a concentation of the id from 'document_relation' table named 'doc_relation_ids'

I have a 'formula url' column in the 'document' table called 'doc_relation_ids_delete' with the following formula:

"" & Replace([doc_relation_ids],",","&key=")

(where nnnn is your database id)

This is replacing the comma separated list of id's inserting the term 'key=' between each value so multiple ids are deleted in one API call.

I added an 'on delete' trigger on the documents table which calls a 'call url' action named 'Delete Document Relations' with the following properties

- 'basic access' for authentication using some teamdesk credentials.
- method= 'get'
- url <%=[doc_relation_ids_delete]%>

so this calls the url as defined in the formula url column when a document is deleted.

Hope that helps !


Nick Ashcroft 2/14/2020 5:54:18 AM
forgot to mention - the concatenation summary is comma separated
Philipp Matuschka (MMB) 2/14/2020 6:09:24 AM
Hi Nick

Thank you. I'll give this a try. Before I dive in, was there any reason you used the concatenate approach rather then using a record set.

Philipp Matuschka (MMB) 2/14/2020 12:01:11 PM
Thank you Nick. After a lot of fiddling around, I got this to work very satisfactorily.
Joseph Kurian 2/14/2020 12:56:54 PM
All those fiddling could be avoided if TD added this feature to the database directly. I know once it is set it will work fine whatever way we do it.

Slava Shinderov  Staff  2/21/2020 7:11:29 AM
@All We've added Delete Record workflow action.
Philipp Matuschka (MMB) 2/21/2020 9:40:11 AM
That's great. Thank you
Joseph Kurian 2/21/2020 11:25:16 AM
Thanks Team TD for this update.

Back to Search Results