AX1085
Deleting plan files from an on-demand file group
Because plan files for on-demand file groups are created "on-the-fly" instead of being generated from a predefined list of dimension elements, there is often a greater need to delete plan files for on-demand file groups. For example:
-
After performing tests on the file group, the administrator wants to delete the plan files that were created during testing. This need is typically unique to on-demand file groups, because when working with standard file groups the administrator would simply use Create Plan Files to re-create all plan files instead of deleting them.
-
End users may create plan files by mistake. Instead of hiding those plan files using a ShowOnList column, a cleaner approach is to delete them. Again, this need is unique to on-demand file groups because end users cannot create plan files for standard file groups.
Although administrators can always delete plan files in Axiom Explorer, the simple act of deleting the plan file is not enough to clean up the system in this case. At minimum, the corresponding record in the plan code table must also be deleted. Data for the plan file may have been saved to other tables, and this data should be deleted as well. Additionally, there may be other artifacts in the system, such as plan file attachments and associated process tasks.
To streamline this process, you can use the Delete Plan Files command to delete plan files instead of performing these tasks manually. When a plan file is deleted using this command, all associated data and system artifacts are also deleted. You can also optionally expose this command to end users so that they can delete plan files that they created by accident.
Delete Plan Files is not exposed on any Axiom menus or dialogs by default. If you want to use the feature, you must add the command to a custom task pane or ribbon tab and then make that task pane or ribbon tab available to the target users of the command. When you configure the command, you must specify a target on-demand file group for which to allow plan file deletion.
When a user executes the Delete Plan Files command from a custom task pane or ribbon tab, it opens the Delete Plan Files dialog. This dialog displays a list of the plan files that the user can delete. Generally speaking, administrators can delete any plan file, whereas end users can only delete plan files that they created (and where they have read/write access). The user can select one or more plan files to delete.
NOTE: There is no equivalent feature to delete plan files for a standard file group, because this is rarely necessary (Create Plan Files can be used to overwrite the existing files as long as the plan codes are still valid). If it is necessary to delete a plan file in a standard file group, then an administrator must manually delete the plan file in Axiom Explorer, and then manually delete any obsolete data in associated tables (the plan code table and any data tables that the file saved to).
Who can use Delete Plan Files
- Administrators and users with the Administer File Groups permission can use the command to delete any plan file in the target file group.
- Non-administrators are treated as follows:
- The command is visible to the user if the user has the Create New Records permission for the target file group, and the user has at least read-only access to some files in the file group.
- The user is limited to deleting plan files where the user has read/write access AND the user is the plan file creator. If the user does not currently have any plan files that meet this criteria, an error message displays when the user attempts to use the Delete Plan Files command.
- Process or workflow elevation is honored for purposes of determining the user's current access level to plan files.
What happens when a plan file is deleted
When a plan file is deleted using Delete Plan Files, the following occurs:
- The plan file is deleted.
- The corresponding identity record in the plan code table is deleted.
- Any corresponding data in linked tables is deleted. Linked tables are eligible for data deletion as follows:
- The table must have a column with a lookup to the identity column in the plan code table.
- This column must have Is Cascade Delete set to True to allow the automatic data deletion. This is set in the column properties.
- All records linked to the deleted identity record in the plan code table will be deleted.
- Any corresponding plan file attachments are deleted (including the attachment folder).
- Any corresponding process or workflow tasks for the plan file are deleted.
Keep in mind that by default, Is Cascade Delete is set to False. You should set this to True if you want to use the Delete Plan Files command. Otherwise, plan file deletion will be prevented if the plan file has corresponding data in other tables.
Example
Imagine that a user creates a new capital request (ID 47) and saves it, which also causes data to be saved to the CPData2020 table. The CPData2020 table has a column CPREQ, with a lookup to the identity column in the plan code table. When the data is saved to CPData2020, it is saved with CPREQ as 47.
The user then realizes that they don't need this particular request, and they want to delete it using Delete Plan Files. If Is Cascade Delete is True for the CPREQ column, then deleting the plan file will also delete records associated with ID 47 in the CPData2020 table. If Is Cascade Delete is False, then the plan file and its plan code cannot be deleted using the Delete Plan Files command.
Setup for Delete Plan Files
The following summarizes the setup steps to use Delete Plan Files for a file group:
-
Identify the tables that plan files in the file group save to, and determine whether the plan code is recorded in those tables. If it is, then enable Is Cascade Delete for the column in the table that looks up to the plan code identity column.
For example, imagine that the plan code table is CPREQ2020 and the identity column is CPREQ. Plan files save data to CPData2020, and that table contains a column
CPData2020.CPREQ
that looks up toCPREQ2020.CPREQ
. In order to delete associated records in CPData2020 when a plan file is deleted, Is Cascade Delete must be enabled forCPData2020.CPREQ
. - Add the Delete Plan Files command adapter to a task pane and set it to the desired file group. You may need to create a new task pane for the command, or you may have an existing task pane that would be appropriate to add it to.
Users can then use the command in the task pane to delete plan files.