P
P
Paw Dude2021-10-23 15:50:56
Java
Paw Dude, 2021-10-23 15:50:56

How to get variables from a process and send an email to the specified address?

I have a bmnn-diagram with a user-task and a service-task, a form with mail and letter text fields in Camunda Modeler.
6174040f2d9ed028338073.jpeg
bpmn diagram

<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL"
                  xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI"
                  xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn"
                  xmlns:di="http://www.omg.org/spec/DD/20100524/DI"
                  xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_10jhcst"
                  targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.11.0"
                  modeler:executionPlatform="Camunda Platform" modeler:executionPlatformVersion="7.15.0">
    <bpmn:process id="MailSender" isExecutable="true">
        <bpmn:startEvent id="StartEvent_1">
            <bpmn:outgoing>Flow_0pzjkz9</bpmn:outgoing>
        </bpmn:startEvent>
        <bpmn:sequenceFlow id="Flow_0pzjkz9" sourceRef="StartEvent_1" targetRef="email-request"/>
        <bpmn:endEvent id="Event_0i7bovx">
            <bpmn:incoming>Flow_1cpeti0</bpmn:incoming>
        </bpmn:endEvent>
        <bpmn:sequenceFlow id="Flow_0mr7ogd" sourceRef="email-request" targetRef="sendmail"/>
        <bpmn:userTask id="email-request" name="Выбор email адреса и ввод текста письма"
                       camunda:formKey="camunda-forms:deployment:email-send.form">
            <bpmn:extensionElements>
                <camunda:inputOutput>
                    <camunda:inputParameter name="text">text</camunda:inputParameter>
                    <camunda:inputParameter name="emailAdress">emailAdress</camunda:inputParameter>
                    <camunda:outputParameter name="email">${emailAdress}</camunda:outputParameter>
                    <camunda:outputParameter name="mailText">${text}</camunda:outputParameter>
                </camunda:inputOutput>
            </bpmn:extensionElements>
            <bpmn:incoming>Flow_0pzjkz9</bpmn:incoming>
            <bpmn:outgoing>Flow_0mr7ogd</bpmn:outgoing>
        </bpmn:userTask>
        <bpmn:sequenceFlow id="Flow_1cpeti0" sourceRef="sendmail" targetRef="Event_0i7bovx"/>
        <bpmn:serviceTask id="sendmail" name="Отправка письма" camunda:delegateExpression="${processSendMail}">
            <bpmn:incoming>Flow_0mr7ogd</bpmn:incoming>
            <bpmn:outgoing>Flow_1cpeti0</bpmn:outgoing>
        </bpmn:serviceTask>
    </bpmn:process>
    <bpmndi:BPMNDiagram id="BPMNDiagram_1">
        <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="MailSender">
            <bpmndi:BPMNEdge id="Flow_1cpeti0_di" bpmnElement="Flow_1cpeti0">
                <di:waypoint x="560" y="117"/>
                <di:waypoint x="652" y="117"/>
            </bpmndi:BPMNEdge>
            <bpmndi:BPMNEdge id="Flow_0mr7ogd_di" bpmnElement="Flow_0mr7ogd">
                <di:waypoint x="370" y="117"/>
                <di:waypoint x="460" y="117"/>
            </bpmndi:BPMNEdge>
            <bpmndi:BPMNEdge id="Flow_0pzjkz9_di" bpmnElement="Flow_0pzjkz9">
                <di:waypoint x="188" y="117"/>
                <di:waypoint x="270" y="117"/>
            </bpmndi:BPMNEdge>
            <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
                <dc:Bounds x="152" y="99" width="36" height="36"/>
                <bpmndi:BPMNLabel>
                    <dc:Bounds x="137" y="142" width="69" height="14"/>
                </bpmndi:BPMNLabel>
            </bpmndi:BPMNShape>
            <bpmndi:BPMNShape id="Event_0i7bovx_di" bpmnElement="Event_0i7bovx">
                <dc:Bounds x="652" y="99" width="36" height="36"/>
                <bpmndi:BPMNLabel>
                    <dc:Bounds x="632" y="142" width="80" height="27"/>
                </bpmndi:BPMNLabel>
            </bpmndi:BPMNShape>
            <bpmndi:BPMNShape id="Activity_0h7rd1s_di" bpmnElement="email-request">
                <dc:Bounds x="270" y="77" width="100" height="80"/>
            </bpmndi:BPMNShape>
            <bpmndi:BPMNShape id="Activity_1orj9ek_di" bpmnElement="sendmail">
                <dc:Bounds x="460" y="77" width="100" height="80"/>
            </bpmndi:BPMNShape>
        </bpmndi:BPMNPlane>
    </bpmndi:BPMNDiagram>
</bpmn:definitions>

617403c5a4f4b728412877.jpeg
The email text has the email-text key.

It is necessary to implement a class in java to receive the user's address and text from the form in order to send an email to the address specified by the user with the specified text.

I do not understand how to write values ​​from the form into variables and process them.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question