Question:
I would like to keep the users from deleting activities of a certain category.
I changed the respective sub in Global Activity: Is this correct?
Sub Application_BeforeDeleteActivity(Activity, ByRef Cancel)
if activity.Category = “RTG” then Cancel = true else Cancel = false
End Sub
Answer:
Typically this needs to be a function not a sub. Look in the Global System there is a sample “OnBeforeFunctionExecute_EditDeleteItem” that does something similar for campaigns.
Basically with these functions you set the function to be True or False.. Change your code to this (no guarantees)
Function Application_BeforeDeleteActivity(Activity, ByRef Cancel)
if activity.Category = “TLS” then Application_BeforeDeleteActivity= true else Application_BeforeDeleteActivity= false
End Function
(Where a return of false prevents the deletion)



