Skip to content

attach workflow related

mandeep6ill edited this page Nov 23, 2017 · 1 revision

Attach Workflow Attributes for Related Models:

There are three extra attributes that needs to specified during the attachment of workflow to basemodel, to enable related model workflow attachment and to approve/reject the related model instances when the base model instance is approved/rejected.

Auto Approval/Rejection of Related Model Workflows:

Attach Sameworkflow to Related Models:

set attachSameWorkflow attribute to true and implictPost to true.

This will attach the same workflow as base model to related models and on the approval/rejection of the base model workflow, the related workflows will be auto approved/rejected.

However, all the related model workflows will create user tasks that are part of their workflows. All the related model user tasks can be seperately approved/rejected which will not effect the base model workflow.

The configuration can be done either through the oe-studio or by posting the data to AttachWorkflow Rest Endpoint. The sample data that needs to be posted is as follows:

    "modelName": "BaseModelName",
    "workflowBody": {
        "workflowDefinitionName": "wfName",
        "processVariables": {}
    },
    "operation": "create",
    "wfDependent": true,
    "attachToRelatedModels": {
            "attachSameWorkflow": true,
            "implicitPost": true
    }

Attach Different Workflows to Related Models:

set attachSameWorkflow attribute to false and implictPost to true. Along with these attributes, you need to specify workflowDefinitionName and processVariables. for each relation (hasMany/ hasOne) of the base model.

The corresponding workflow based on the relation name, to the related models is attached and will auto approve/reject the workflows based on the base model workflow approval/rejection.

The configuration can be done either through the oe-studio or by posting the data to AttachWorkflow Rest Endpoint. The sample data that needs to be posted is as follows:

    "modelName": "BaseModelName",
    "workflowBody": {
        "workflowDefinitionName": "wfName",
        "processVariables": {}
    },
    "operation": "create",
    "wfDependent": true,
    "attachToRelatedModels": {
            "attachSameWorkflow": false,
            "implicitPost": true,
            "relatedModelWorkflowBody": {
                "relationName1": {
                    "workflowDefinitionName": "wfName1",
                    "processVariables": {}
                },
                "relationName2": {
                    "workflowDefinitionName": "wfName1",
                    "processVariables": {}
                }
            }
    }

Independent Approval/Rejection of Related Model Workflows

Attach Sameworkflow to Related Models:

set attachSameWorkflow attribute to true and implictPost to false.

This will attach the same workflow as base model to all the related models. But the base model workflow will have no effect on the related model workflows. All the approvals of related and base models are independent of each other.

The configuration can be done either through the oe-studio or by posting the data to AttachWorkflow Rest Endpoint. The sample data that needs to be posted is as follows:

    "modelName": "BaseModelName",
    "workflowBody": {
        "workflowDefinitionName": "wfName",
        "processVariables": {}
    },
    "operation": "create",
    "wfDependent": true,
    "attachToRelatedModels": {
            "attachSameWorkflow": true,
            "implicitPost": false
    }

Attach Different Workflows to Related Models:

set attachSameWorkflow attribute to false and implictPost to false. Along with these attributes, you need to specify workflowDefinitionName and processVariables for each relation (hasMany/ hasOne) of the base model.

The corresponding workflow based on the relation name, to the related models is attached and all the related, base model workflows need to be approved/rejected independently.

The configuration can be done either through the oe-studio or by posting the data to AttachWorkflow Rest Endpoint. The sample data that needs to be posted is as follows:

    "modelName": "BaseModelName",
    "workflowBody": {
        "workflowDefinitionName": "wfName",
        "processVariables": {}
    },
    "operation": "create",
    "wfDependent": true,
    "attachToRelatedModels": {
            "attachSameWorkflow": false,
            "implicitPost": false,
            "relatedModelWorkflowBody": {
                "relationName1": {
                    "workflowDefinitionName": "wfName1",
                    "processVariables": {}
                },
                "relationName2": {
                    "workflowDefinitionName": "wfName1",
                    "processVariables": {}
                }
            }
    }

How the auto approve/reject of related models work ?

If the attribute implicitPost is set to true, and if attachSameWorkflow is either true/ false, the workflow of the related models is attached to RelatedModelWorkflowTemplate as a callActivity(Subprocess). And the base model workflow is similarly attached as a call activity to BaseModelWorflowTemplate. The signal events between these two templates operates in such a way, that if the BaseModelWorflowTemplate is approved/rejected, it will signal all the related RelatedModelWorkflowTemplate workflows to either approve/reject.