Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Workflow of AddNewRelationAction by defining the reverse relation on the new item instead #94

Open
jongleur1983 opened this issue Sep 28, 2022 · 0 comments

Comments

@jongleur1983
Copy link

We use the extension for some use cases and I like it.
A small issue often people in our team struggle with is the workflow on an AddNewRelationAction.

As an example we have configured an "Add Review Task" action that adds a new work item of type task with a certain template to an existing Product Backlog Item as a one click action.

It should make it easy to create such a task.
Unfortunately the required workflow is as follows:

  1. From the PBI click the OneClickAction button "Create Review Task".
  2. Fill in possible required content (often even the template is sufficient as is
  3. Save the Review Task (with it's content, not saving the relation as it's not yet attached to the Review Task, but to the PRBI)
  4. Save the PBI the review Task is added to (to apply the relation as well).

Often Step4 is forgotten, and I think there's a relatively easy way to fix that in the extension logic.

** How the extension works, yet **
The current logic from https://github.com/mohitbagra/vsts-extensions/blob/master/src/Apps/OneClick/scripts/RuleActions/AddNewRelationAction.tsx as far as I understand it adds the Relation to the PBI and therefore requires saving that.

** How it could be improved **
Instead, the Reverse of that relation could be added to the new, unsaved item.

** Required code changes **
(as pseudo code as I don't know yet how to implement and especially test changes)

Affected parts of the code should be these:
https://github.com/mohitbagra/vsts-extensions/blob/master/src/Apps/OneClick/scripts/RuleActions/AddNewRelationAction.tsx#L64-L79

Here, the savedWorkItem (which is the newly created one) is addad as a relation to the existing Item.
Rephrasing that part by some kind of pseudo code:

const selectedRelationType = RelationTypeAsConfiguredForAction(); // in my example "child-of"
const relation = new Relation(to: newItem, type: selectedRelationType)M
workItemFormService.addWorkItemRelations([relation]);

I propose to instead do the following before saving the work item at all:

const selectedRelationType = InverseRelationTypeAsConfiguredForAction(); // in my example "parent-of"
const relation = new Relation(url: originalPbi, rel: selectedRealtionType.referenceName);
AddRelationToNewItem(relation)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant