# Feature BNE-29 - Create work package via slash command in a document

Project: Stream BlockNote extensions
Status: closed
URL: https://community.openproject.org/work_packages/BNE-29

## Planning

| Attribute | Value |
| --- | --- |
| Date |  |
| Priority | Medium |
| Target versions | 17.9.0 |
| Sprint |  |
| Backlog bucket |  |
| Votes |  |
| List |  |
| Roadmap |  |
| Relevance |  |

## OPEN POINTS / FEEDBACK

_No work packages_

## Features and Chunks

| ID | Subject | Type | Status | Assignee | Target versions | Spent time |
| --- | --- | --- | --- | --- | --- | --- |
| BNE-129 | Add create work package flow (simple) | Implementation | closed |  | 17.9.0 |  |
| BNE-130 | Prefill fields from previous selections | Implementation | closed |  | 17.9.0 |  |
| BNE-133 | Show type colors in Type select | Implementation | closed |  | 17.9.0 |  |
| BNE-134 | Improve project select | Implementation | closed |  | 17.9.0 |  |
| BNE-135 | Add multiselect field for multiselect required values | Implementation | closed |  | 17.9.0 |  |
| BNE-140 | Remember filled in fields when type changes | Implementation | closed |  | 17.9.0 |  |
| BNE-146 | Make the create modal grow smoothly instead of jumping | Implementation | closed |  | 17.9.0 |  |

## Bugs and other work packages

| ID | Type | Subject | Status | Assignee | Target versions | Spent time | Module |
| --- | --- | --- | --- | --- | --- | --- | --- |
| BNE-160 | Bug | Documents: In create work package modal, hierarchy/weighted item list custom field's dropdown's values are invisible | rejected |  | 17.9.0 |  | Modules and project features / Documents, Modules and project features / Text editor / BlockNoteJS |
| BNE-159 | Bug | Documents: In create work package modal, subject is hidden when it's automatically generated | closed |  | 17.9.0 |  | Modules and project features / Documents, Modules and project features / Text editor / BlockNoteJS |
| BNE-157 | Bug | Changing type sometimes moves the focus to the subject | closed |  | 17.9.0 |  | Modules and project features / Documents, Modules and project features / Text editor / BlockNoteJS / OpenProject Extensions |
| BNE-156 | Bug | There should be no auto-suggestions for the subject field in the create work package dialog in a document | closed |  | 17.9.0 |  | Modules and project features / Documents, Modules and project features / Text editor / BlockNoteJS / OpenProject Extensions |
| BNE-153 | Bug | Values in dropdown not shown for required field of type hierarchy | closed |  | 17.9.0 |  | Modules and project features / Documents, Modules and project features / Text editor / BlockNoteJS / OpenProject Extensions |
| BNE-152 | Bug | Favorites not found in the project picker on QA edge | closed |  | 17.9.0 |  | Modules and project features / Documents, Modules and project features / Text editor / BlockNoteJS / OpenProject Extensions |
| BNE-158 | Bug | Documents: User without permissions to create work packages still sees the command to create a new work package | closed |  | 17.9.0 |  | Modules and project features / Documents, Modules and project features / Text editor / BlockNoteJS |
| BNE-166 | Bug | Documents: In create work package modal, automatic subject placeholder text is cut off on small screens | closed |  | 18.0.0 |  | Modules and project features / Documents, Modules and project features / Text editor / BlockNoteJS |
| BNE-162 | Bug | Unable to close dropdown for required custom fields (except for clicking anywhere else) | closed |  | 18.0.0 |  | Modules and project features / Documents, Modules and project features / Text editor / BlockNoteJS / OpenProject Extensions |
| BNE-161 | Bug | Typeahead picker options often covered by keyboard on mobile | closed |  | 18.0.0 |  | Modules and project features / Documents, Modules and project features / Text editor / BlockNoteJS / OpenProject Extensions |

## Technical Details

| Attribute | Value |
| --- | --- |
| Module | Modules and project features / Documents |
| Feature Flag |  |
| Requires doc change | Yes |
| Enterprise plan |  |

## Details

| Attribute | Value |
| --- | --- |
| Pull preview |  |
| Mockups | https://www.figma.com/design/d3zhm0R0pjHJvQd3XTlxuS/New-Documents-module?node-id=3265-3673 |
| Accessibility | No |

## People

| Attribute | Value |
| --- | --- |
| Assignee |  |
| Accountable |  |
| Product manager |  |
| Developers |  |
| Designer | Parimal Satyal |
| Ordered by |  |
| Signed off by |  |
| Interest by |  |

## Estimates and progress

| Attribute | Value |
| --- | --- |
| PD (min) |  |
| PD (max) |  |
| Work |  |
| Labor costs |  |

## Description

**As** a user  
**I want to** create a new work package from the document  
**so that** I can easily organise work without switching context.

**Acceptance criteria**

  - Invoke via Slash command
    
      - Same as for "Link work package", but with:
        
          - icon: `plus`
        
          - Label: "Create new work package"
        
          - Subtitle: "Create a new work package and add a link to it"

  - Only users who are allowed to create work packages see the command (?)

  - After the slash command is invoked, a modal is shown to create a new work package. This modal uses progressive disclosure, i.e, only some fields are visible initially, and other are shown progressively based on user input: Initial state:
    
      - Subject (not prefilled, required)
    
      - Project (required)
        
          - Typeahead dropdown (`/api/v3/work_packages/available_projects`)
        
          - The user can pick from all projects where the user is allowed to create work packages are listed
        
          - Prefilled with
            
              - if rendered inside OpenProject: The project of the document
            
              - if rendered outside OpenProject: The project of the work package that was created before in the same session by the same user (left empty if none was created so far)
    
      - Once project is selected, show:
        
          - Assignee (not required)
            
              - Typeahead dropdown 
            
              - The list contains all members of the selected project
            
              - Prefilled with the assignee that was selected on creation of the last work package in op-blocknote-extensions by that user in the same session
            
              - If no work package was created before, it is left empty
            
              - `/api/v3/workspaces/4/available_assignees`
        
          - Type (required)
            
              - the possible types depend on the project (**get** `/api/v3/projects/{id}/types`)
            
              - prefilled with the type that was selected on creation of the last work package in op-blocknote-extensions by that user in the same session
            
              - if no work package was created before, the default type is selected (the first in the list)
    
      - Once type is selected, show:
        
          - ~~status~~
            
              - ~~prefilled with the status that was selected on creation of the last work package in op-blocknote-extensions by that user in the same session~~
            
              - ~~If no work package was created before, the default status is selected (the first in the list)~~
            
              - ~~available statuses depend on the type, so the type needs to be chosen first~~
        
          - Required fields (required)
            
              - These could be of a number of different types: input, select, checkbox, radio button group, multi-select list.
                
                  - *Note: We should should not hard code them, because there could be fields added alter.*

  - The field labels should be translated to the chosen locale (we somehow need to get the translations from OpenProject - if it's complext to do that, it could be a separate PR)

  - Creates a work package link the document
    
      - When invoked on an empty paragraph / new line a card work package link is created
    
      - When invoked in the middle of a line an inline work package link is created

  - There should be the usual form validations on form submit, including for required fields

**Technical hints**

  - An empty POST to `/api/v3/projects/<id>/work_packages/form` returns the schema for the form.
    
      - For each attribute it will list if it is required.
    
      - For each attribute it includes either links to the API where allowed values are listed, or allowed values directly as a list.

  - There is also `/api/v3/work_packages/schemas/<project-id>-<type-id>` to get the schema for a work package for a project and a given type - however, type id and project need to be known to use this. Probably using the form endpoint mentioned above is the better alternative.

  - Prefilling the form values with the values from the last created work package should be a separate implementation chunk (not in the first PR)

**Translation considerations**

  - The slash command needs to be translated (same logic as for the link work package command)
