AdvoLogix Help

Deleting an Activity Plan via Code

Updated on

The following Apex method can be used to delete an Activity Plan via custom coding. Please be aware this method uses asynchronous processing techniques that require knowledge of Force.com best practices as they relate to asynchronous processing. It is always suggested to test your code in the Sandbox.

Syntax:
ActionPlansUtilitiesExternal.DeleteActionPlan(
    @actionPlanId,
    @deleteAction
); 

Parameters:
@actionPlanId
The Activity Plan record ID which is to be deleted.

@deleteAction 
The delete action guides action to be taken for related Activities created as part of the Activity Plan. The accepted parameter values are these:

  • ActionPlanOnly
    To delete Activity Plan only and keeping all the activities.

  • ActionPlanWithIncompleteActivitiesOnly
    To delete Activity Plan and keep past and completed activities only.

  • ActionPlanWithAllActivities
    To delete Activity Plan with all activities associated with it.
     

Result:
The function call will return a JSON formatted string in this format: {success:"",result:""} 

success
Will be either TRUE or FALSE

result
Confirmation message of process completion OR Error message if process is hauled with any unexpected error.  

Example:
ActionPlansUtilitiesExternal.DeleteActionPlan(
  'a0B900000101axm',
  'ActionPlanOnly'); 

Multiple actionPlanId parameters can be passed to delete multiple Activity Plans for several Matter objects with a single function call. Use a ',' (comma) to separate the ID values. e.g: 'a0B900000101axm,a0B900000102axm,a0B900000103axm'  

Example Using a Link from the Matter Context
Previous Article Updating an Activity Plan via Code
Next Article Creating an Activity Plan via Process Builder
Still need help? Click here!
AdvoLogix® is a registered trademark of AdvoLogix.com LLC a Texas Limited Liability Company. All references to other trademarks belonging to third parties that appear on this website, documentation, or other materials shall be understood to refer to those registered trademarks owned by others, and not to any trademark belonging to AdvoLogix. Otherwise, all material herein is the copyright of AdvoLogix.com LLC. All Rights Reserved.