Update /set_parent work item quick action to fail gracefully when parent is invalid
Summary
When the /set_parent or /epic command is run on a work item with an invalid or null parent, the command fails with the following error. When this command is in a template which is applied to a new work item, this will block creation. This behaviour differs from the existing /epic command on legacy issues, which silently fails the quick action, but proceeds to create the work item regardless.
One or more arguments are invalid: set_parent.
Steps to reproduce
- Create a work item template with an invalid or null parent. e.g.
/set_parent not_a_valid_parent
- Create a new work item issue and apply the template
- Click "Create issue" and observe the error returned
Alternatively
- Select a pre-existing issue and add a comment with the
/epicor/set_parentquick action with an invalid parent (e.g./set_parent not_a_valid_parent) - Click "Comment"
- Observe the error returned
Example Project
Any work item on any project will exhibit this behaviour
What is the current bug behavior?
- The error returned is not user friendly
- Creation of work items with a template containing this quick action with an invalid parent is blocked
What is the expected correct behavior?
- The error message should more succinctly describe the issue
- Creating a work item with this quick action with an invalid parent should not block creation
Relevant logs and/or screenshots
Possible fixes
- When the
/set_parentquick action is called (or the corresponding/epicalias), we should check to see if the parent we're referencing cannot be found, similar to the check in the existing legacy/epicquick action. - We can simply update the execution message to something like:
This parent does not exist or you don't have sufficient permission.and not attempt to set the parent if the referenced work item cannot be found. Doing this should allow any work items with templates with an invalid parent to proceed, and provide a more useful error message when the reference is invalid
