簡體   English   中英

如何通過 Camunda Rest-Api 獲取表單字段值

[英]How to get form-field values via Camunda Rest-Api

有沒有辦法顯式獲取用戶任務表單字段的值? 我有一個包含三個枚舉值的表單字段。

在此處輸入圖像描述

當我執行 REST 調用/task/{id}/form-variables時,我得到以下 output:

{
"pruefungOk": {
        "type": "String",
        "value": null,
        "valueInfo": {}
    }
}

但我想要的是這樣的:

{
"pruefungOk": {
        "type": "String",
        "value": null,
        "valueInfo": {},
        "availableValues": ["ok", "notOk", "helloTest"] <-- Array of the values from first picture
    }
}

如果沒有解決方法和臟代碼,這是否可能? 為什么沒有 REST Call for that?

https://docs.camunda.org/manual/7.13/reference/rest/task/get-rendered-form/ 有幫助嗎? 我知道它並不完美,但應該包含選項。

To extract static information from the bpmn file you can also always resort to https://docs.camunda.org/manual/7.13/reference/rest/process-definition/get-xml/ and then apply eg jQuery to the bpmn20Xml in the回復。

我知道這有點晚了,但也許你會在其他時候使用它,或者它會對其他人有所幫助。 我所做的是以下內容:

TaskFormData taskFormData = ProcessEngines.getDefaultProcessEngine().getFormService().getTaskFormData(taskId);

之后獲取值:

taskFormData.getFormFields()
            .forEach(formField -> {
                if (formField.getType() instanceof EnumFormType) {
                    ((EnumFormType) (formField.getType())).getValues().forEach((key, value) -> {
                        System.out.println("This is the key:" + key);
                        System.out.println("This is the value:" + value);
                    });
                }
            });

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM