Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

使用JSON工具可以发出JSON Web服务调用,并将返回的数据保存到Joget的表单数据或/和进程的工作流变量中。

Image Added
图1:JSON工具属性 - 配置JSON工具

名称描述
JSON网址要调用的网址。


图2:JSON工具属性 - 存储到表单

名称描述
形成目标表单来存储数据。
多行数据的基础JSON对象名称包含要基于的数组的对象的名称。
字段映射

使用表单字段映射JSON数据。

名称描述
字段名称表单字段ID
JSON对象名称JSON属性名称

Image Added
图3:JSON工具属性 - 存储到工作流变量

名称描述
工作流变量映射
名称描述
工作流变量工作流程变量名称。
JSON对象名称JSON属性名称。

Image Added

在图2和图3中,需要指定如何处理返回的数据。返回的数据可以保存为表单数据或/添加保存到流程的工作流程变量中。本文中使用的示例显示了如何将多行数据存储到表单数据表中。

示例JSON API:  http:// localhost:8080

The JSON Tool enables one to issue a JSON webservice call and to save the returned data into Joget's form data or/and into the process's workflow variable.

Image Removed
Figure 1: JSON Tool Properties - Configure JSON Tool

NameDescription
JSON URLURL to be called.

...

NameDescription
FormTarget form to store data to.
Base JSON Object Name for Multirow DataName of the object that contains an array to be based on.
Field Mapping

Mapping with JSON data with Form fields.

NameDescription
Field NameForm field ID
JSON Object NameJSON property name

Image Removed
Figure 3: JSON Tool Properties - Store to Workflow Variable

NameDescription
Workflow Variable Mapping
NameDescription
Workflow VariableWorkflow Variable Name.
JSON Object NameJSON property name.

Image Removed

In figure 2 and 3, one will need to specify on how to treat the returned data. The returned data may be saved as form data or/add to be saved into process's workflow variable. The example used in this article shows on how one can store multi-row data into a form data table.

Sample JSON API: http://localhost:8080 / jw / web / json / apps / published / userviewsSample JSON Result: 

示例JSON结果: 

Code Block
langjavascript
{
    "apps": [{
        "id": "crm",
        "name": "CRM",
        "userviews": [{
            "id": "crm_userview_sales",
            "description": "",
            "name": "CRM: Sales Force Automation",
            "url": "/jw/web/userview/crm/crm_userview_sales",
            "version": 1
        }],
        "version": 1
    }, {
        "id": "hr_expense",
        "name": "HR Expenses Claim App",
        "userviews": [{
            "id": "hr_expense_userview",
            "description": "",
            "name": "HR Expenses Claim App for Admin",
            "url": "/jw/web/userview/hr_expense/hr_expense_userview",
            "version": 2
        }],
        "version": 2
    }, {
        "id": "isr",
        "name": "Internal Service Request",
        "userviews": [{
            "id": "isr",
            "description": "",
            "name": "Internal Service Request App",
            "url": "/jw/web/userview/isr/isr",
            "version": 1
        }],
        "version": 1
    }, {
        "id": "ims",
        "name": "Simple Invoicing",
        "userviews": [{
            "id": "ims",
            "name": "Simple Invoicing",
            "url": "/jw/web/userview/ims/ims",
            "version": 1
        }],
        "version": 1
    }]
}


Figure 4: Sample JSON data saved in Joget form data table图4:保存在Joget表单数据表中的示例JSON数据

您可以从You can download the test app from APP_json1-1-20151026181405.jwa.下载测试应用程序  。