bpmn-js-spiffworkflow icon indicating copy to clipboard operation
bpmn-js-spiffworkflow copied to clipboard

Support attaching forms to message start events like we do with user tasks

Open burnettk opened this issue 11 months ago • 6 comments

right now the bpmn xml for user tasks can look like this with our extensions:

    <bpmn:userTask id="user_task_one" name="User Task One">
      <bpmn:extensionElements>
        <spiffworkflow:properties>
          <spiffworkflow:property name="formJsonSchemaFilename" value="second-form-schema.json" />
          <spiffworkflow:property name="formUiSchemaFilename" value="second-form-uischema.json" />
        </spiffworkflow:properties>
        <spiffworkflow:allowGuest>false</spiffworkflow:allowGuest>
        <spiffworkflow:instructionsForEndUser />
        <spiffworkflow:guestConfirmation># Thanks

We hear you. Your name is **{{incoming_request['firstName']}}**.</spiffworkflow:guestConfirmation>
      </bpmn:extensionElements>
      <bpmn:incoming>Flow_12pkbxb</bpmn:incoming>
      <bpmn:outgoing>Flow_14h4dnh</bpmn:outgoing>
    </bpmn:userTask>

we would like to be able to use most of the same ability to attach json schemas to message start events. we'd like to be able to specify a formJsonSchemaFilename and formUiSchemaFilename, as well as specify instructionsForEndUser and guestConfirmation. i think we do not need allowGuest, eh, @jasquat ? these extensions are respected in backend, but we'd like to be able to craft the appropriate xml through our bpmn js properties panel extensions.

so something like this, but maybe without the [object Object], which may be an existing bug:

    <bpmn:startEvent id="message_start_event_one" name="Message Start Event One" messageRef="[object Object]">
      <bpmn:extensionElements>
        <spiffworkflow:properties>
          <spiffworkflow:property name="formJsonSchemaFilename" value="entry-form-schema.json" />
          <spiffworkflow:property name="formUiSchemaFilename" value="entry-form-uischema.json" />
        </spiffworkflow:properties>
        <spiffworkflow:instructionsForEndUser>Hi</spiffworkflow:instructionsForEndUser>
        <spiffworkflow:guestConfirmation>Thanks</spiffworkflow:guestConfirmation>
      </bpmn:extensionElements>
      <bpmn:outgoing>Flow_17db3yp</bpmn:outgoing>
      <bpmn:messageEventDefinition id="MessageEventDefinition_13ctnqx" messageRef="Message_1rfi4qj" />
    </bpmn:startEvent>

maybe we should get rid of <spiffworkflow:properties> ? it seems weird to have just those two form properties in there. perhaps we support <spiffworkflow:formJsonSchemaFilename> and <spiffworkflow:formUiSchemaFilename> and deprecate <spiffworkflow:properties>.

burnettk avatar Mar 14 '24 21:03 burnettk

Form is going to be generated from the message's JSON schema. This will necessitate enhancements to the JSON schema to support UI attributes.

The XML that defines a start event with a message element that includes forms can be structured as follows:

<bpmn:startEvent id="message_start_event_one" name="Message Start Event One" messageRef="basic_message">
  <bpmn:extensionElements>
    <spiffworkflow:instructionsForEndUser>Hi</spiffworkflow:instructionsForEndUser>
    <spiffworkflow:guestConfirmation>Thanks</spiffworkflow:guestConfirmation>
  </bpmn:extensionElements>
  <bpmn:messageEventDefinition id="MessageEventDefinition_13ctnqx" messageRef="basic_message" />
  <bpmn:outgoing>Flow_17db3yp</bpmn:outgoing>
</bpmn:startEvent>

<bpmn:message id="basic_message" name="basic_message" schemaLocation="grp1/p1" />

UI :

image image

theaubmov avatar Apr 08 '24 18:04 theaubmov

@calexh-sar do we need this for bounties?

harmeet-status avatar Apr 23 '24 09:04 harmeet-status

@harmeet-status yes, this is the best way to do the initial Message Start Event.

calexh-sar avatar Apr 23 '24 11:04 calexh-sar

Seems like 3 things need to happen:

  1. BPMN IO - Need to add form builder link to messages (1 day)
  2. Form Builder - switch to save to one file, rather than 3. backwards compatible with 3 (see also #1442) (2 days)
  3. XML Property - merge three properties into one, with a new property name. (.5) (jsonschema-single-file branch in arena)
  4. Messages can reference a file (absolute path) (.5 day)

danfunk avatar Apr 23 '24 19:04 danfunk

Seems like 3 things need to happen:

  1. BPMN IO - Need to add form builder link to messages (1 day)
  2. Form Builder - switch to save to one file, rather than 3. backwards compatible with 3 (2 days)
  3. XML Property - merge three properties into one, with a new property name. (.5)
  4. Messages can reference a file (absolute path) (.5 day)

Are these existing tickets?

harmeet-status avatar Apr 24 '24 05:04 harmeet-status

@harmeet-status all work will be done under this ticket.

calexh-sar avatar Apr 24 '24 11:04 calexh-sar