1
class HelloWorldFlow(Flow):
    process_class = HelloWorldProcess
    ######### Here I start the process where i enter some text

    start = (
        flow.Start(CreateProcessView, fields=["text"])
        .Permission(auto_create=True)
        .Next(this.approve)
    )

    ######### Here i update the process view with the user name which i obtained from "asignedto"- which consist of all the user in a drop down

    approve = (
        flow.View(UpdateProcessView, fields=["asignedto"])
        .Assign(lambda act: act.process.created_by)
        .Permission(auto_create=True)
        .Next(this.task_assign)
    )
    ######### Below is the code where i am facing difficulty i am not able to know how to pass the user name in the .Assign()
    ######### This one works .Assign(username="Debasish"), however i want to assign the user based on previous workflow which is approve, where i selected from the drop down
    ######### This one do not work .Assign(username=this.approve.owner)

    task_assign = (
        flow.View(AssignTaskView)
        .Assign(this.approve.owner)
        .Next(this.check_approve)
    )
    ######### Below this its working

    check_approve = (
        flow.If(lambda activation: activation.process.approved)
        .Then(this.send)
        .Else(this.end)
    )

    send = flow.Handler(this.send_hello_world_request).Next(this.end)

    end = flow.End()

    def send_hello_world_request(self, activation):
        print(activation.process.text)
4

1 回答 1

0

BPMN 的优势之一是流程可追溯性。您无法实施不会保留流程决策的流程。这对于流程性能分析非常方便。

BPMN 中的每个任务都是相互独立的,并且只能对流程数据执行决策。这为流程图提供了灵活性,并允许重新排列流节点,因为它们之间只有数据存储依赖关系。


所以,简短的回答 - 将用户存储在 Process 模型中并使用.Assign(lambda act: act.process.granted_user_for_a_task)

于 2018-08-10T05:54:26.013 回答