先决条件
请在代码中包含 CSS 代码 https://css.zohocdn.com/projects/styles/zps-extn/client_sdk.css,以便使用 Zoho Projects 样式。
init
初始化扩展程序。
zohoprojects.init().then(function(){});
必须在开始时调用此方法,因为其他 SDK 方法只有在调用此方法后才能生效。在 init 加载期间,如果您想使用其他函数,可以在 init 函数中调用。
zohoprojects.init().then(function () {
zohoprojects.get("portal.name").then(function (response)
});
metadata
获取扩展程序的付款和配置详细信息。
},
"status": "success"
}
}
*/
});
context
获取当前位置的模块名称和实体 ID。模块名称为“tasks”或“issues”,实体 ID 为相应任务或问题的 ID。
zohoprojects.context().then(function(response)
{
/* output
{
"module_name": "tasks",
"entity_id": "27092000000031079"
}
*/
});
get
get 当前位置的实例、当前用户、门户、项目、任务和问题的详细信息。
zohoprojects.get("task.id
").then(function(response)
{
/* output
{
"data": 27092000000031080,
"status": "success"
}
*/
});
以下是 get 方法中可以使用的键的列表:
实例
instances
当前用户
current_user
门户
portal.trial_enabled
portal.settings
portal.gmt_time_zone
portal.project_count
portal.role
portal.avail_user_count
portal.locale
portal.project_prefix
portal.available_projects
portal.max_user_count
portal.profile_id
portal.name
portal.id_string
portal.bug_plural
portal.plan
portal.bug_plan
portal.bug_singular portal.default
portal.extensions
portal.is_crm_partner
portal.is_display_projectprefix
portal.is_display_taskprefix
portal.is_new_plan
portal.layouts
portal.link
项目
project.is_strict
project.role
project.bug_count
project.owner_id
project.taskbug_prefix
project.link
project.description
project.milestone_count
project.updated_date_long
project.task_count
project.updated_date_format
project.workspace_id
project.billing_status
project.key
project.is_chat_enabled
project.owner_name
project.profile_id
project.enabled_tabs
project.name
project.is_public
project.layout_details
project.status
project.permissions
project.IS_BUG_ENABLED
project.bug_defaultview
project.bug_prefix
project.cascade_setting
project.completed_on
project.completed_on_long
project.created_date
project.created_date_format
project.created_date_long
project.custom_status_id
project.id_string
project.show_project_overview
project.start_date
project.start_date_long
project.updated_date
project.users
project.customfields
project.custom_fields
任务
task.name
task.completed
task.created_by
task.priority
task.percent_complete
task.start_date
task.end_date
task.dependency
task.duration
task.details
task.link
task.created_person
task.created_time
task.created_time_format
task.created_time_long
task.custom_fields
task.depth (applicable for subtasks only)
task.duration_type
task.id_string
task.is_comment_added
task.is_forum_associated
task.is_recurrence_set
task.is_reminder_set
task.isparenttask.key
task.last_updated_time
task.last_updated_time_format
task.last_updated_time_long
task.milestone_id
task.order_sequence
task.parent_task_id (applicable for subtasks only)
task.parenttask_id (applicable for subtasks only)
task.root_task_id (applicable for subtasks only)
task.status
task.task_followers
task.tasklist
task.worktask.work_type
task.comments
task.subtasks
task.customfields
task.attachments
问题
issue.module
issue.created_time_long
issue.customfields
issue.status
issue.reproducible
issue.link
issue.severity
issue.reported_person
issue.title
issue.flag
issue.assignee_name
issue.reporter_id
issue.classification
issue.created_time_format
issue.closed
issue.created_time
issue.key
issue.attachment_count
issue.bug_number
issue.bug_prefix
issue.comment_count
issue.escalation_level
issue.id_string
issue.reporter_email
issue.reporter_non_zuser
issue.updated_time
issue.updated_time_format
issue.updated_time_long
issue.attachments
issue.comments
issue.views
里程碑
milestone.closed
milestone.comments_count
milestone.created_time
milestone.created_time_format
milestone.created_time_long
milestone.end_date
milestone.end_date_format
milestone.end_date_long
milestone.flag
milestone.has_comments
milestone.id
milestone.id_string
milestone.is_workfield_removed
milestone.last_updated_time
milestone.last_updated_time_format
milestone.last_updated_time_long
milestone.link
milestone.name
milestone.owner_id
milestone.owner_name
milestone.owner_zpuid
milestone.project
milestone.sequence
milestone.start_date
milestone.start_date_format
milestone.start_date_long
milestone.status
milestone.status_det
已选择文件
队列中待上传的文件存储在 chosen_files 中。此键仅支持附件选择器。
chosen_files
部署类型
获取当前数据中心。
zohoprojects.get("deployment_type").then(function() {
/* output
com
*/
});
个人资料
我们支持几个键,分别用于获取门户级别的所有个人资料和当前用户的个人资料详情。
all_profiles:获取门户中所有个人资料的信息。
current_profile:获取当前用户的个人资料详情。
主题
Zoho Projects 支持为您的门户提供主题。
current_theme: Fetches the current theme.
zohoprojects.get("current_theme").then(function() {
/* output
{mode: "default", zpPrimary: "255, 100, 0", zpPrimaryHover: "255, 247, 243"}
*/
});
蓝图中
blueprint_during: fetches the value set for the During action
zohoprojects.get("blueprint_during").then(function(res) {
/* output
[ {field_id: "UDF_CHAR1", is_visible: true, is_pii: false, is_encrypted: false}
{field_id: "UDF_CHAR2", is_visible: true, is_pii: false, is_encrypted: false}]
*/
});
迁移
获取当前转换的详细信息。
迁移:获取当前转换的 ID 和名称。
蓝图:获取蓝图 ID 和名称。
设置
更新当前位置的特定任务或问题的属性。
可以在任务的设置方法中使用以下键:
var nameObj={name:"Create a new checklist"};
zohoprojects.set("task",nameObj).then(function(response)
{
/* output
{
"data": {
任务
person_responsible
owner_work
work_type
name
start_date
end_date
start_time
end_time
percent_complete
duration
duration_type
reminder
priority
description
custom_fields (This key can be used only to create a custom field.)
clear_date
index
range
json_string
可以在问题的设置方法中使用以下键:
问题
title
description
assignee
flag
classification_id
milestone_id
due_date
module_id
severity_id
reproducible_id
status_id
resolution
affectedmile_id
可以在 set 方法中使用以下键来更新项目:
项目
name
description
status
start_date
end_date
strict_project
public
group_id
completed_on
UDF_CHAR([1-9]|[1-2][0-9]|30). Example: UDF_CHAR1
UDF_TEXT([1-9]|1[0-5])
UDF_LONG([1-9]|1[0-5])
UDF_USER[1-5]
UDF_DOUBLE([1-9]|[1-2][0-9]|3[0-5])
UDF_DATE[1-5]
UDF_ENCRYPT([1-9]|10)
owner
billing_method
bill_status
show_project_overview
custom_status
可以在设置方法中使用以下键来更新里程碑:
里程碑
name
start_date
end_date
owner
flag
budget
threshold
revenue_budge
链接文件
使用 linkfiles 键将文件与您的位置关联。此键支持以下位置:任务详情选项卡、问题详情选项卡、附件选择器。它必须是一个最大长度为 10 的数组,并且以下字段为必填字段:id、name、type、permanent_url、download_url、size、created_by、created_time;图片文件的 preview_url 为必填字段。
linkfiles
"name": "sample-image.jpeg",
"download_url": "https://drive.google.com/a/web-mailhosting.com/uc?id=1LavBS5sauJ-AAFJZWp8Ch9Cp2ehydahk&export=download",
}]
zohoprojects.set('linkfiles', linkFiles).then(function (response) {
zohoprojects.invoke('attachment_picker.close');
});
蓝图中
在配置蓝图迁移的“期间”操作时设置该值。
var sample = [ {field_id: "UDF_CHAR1", is_visible: true, is_pii: false, is_encrypted: false}
{field_id: "UDF_CHAR2", is_visible: true, is_pii: false, is_encrypted: false}];
zohoprojects.set("blueprint_during", sample).then(function(res) {
/* output
[ {field_id: "UDF_CHAR1", is_visible: true, is_pii: false, is_encrypted: false}
{field_id: "UDF_CHAR2", is_visible: true, is_pii: false, is_encrypted: false}]
*/
导出位置
将您的任务导出到云存储服务。您最多可以选择五个数据字段,显示在导出详情弹出窗口中。如果在显示数据中添加了链接参数,所选位置将以超链接形式显示,方便访问。
let paramObj = {
"custom_data": {
"path": "G/pics",
"portal_id": "89031033",
"project_id": "185977000000199005"
},
Request
使用 plugin-manifest.json 文件中定义的连接,从您的扩展程序调用第三方 URL。如果未指定连接链接名称,则根据输入提供响应。
var file = document.getElementById("inputbox").files[0];
var file_detail = {
type: "GET",
files: [{
uploaddoc : file
type : "binary" //If the file is uploaded as binary
}],
parameters: {
fields: "id,name, thumbnailLink, webViewLink, webContentLink"
}
};
var url = "https://www.googleapis.com/drive/v3/files/1-QabBt69U8myXYRDVU-1YiCo2k-JWRfu";
zohoprojects.request(url, file_detail, "google_drive").then(function (response)
/* Output
{
"result": {
"webContentLink": "https://drive.google.com/uc?id=1-QabBt69U8myXYRDVU-1YiCo2k-JWRfu&export=download",
"name": "Eiffel_Tower_01.jpg",
"webViewLink": "https://drive.google.com/file/d/1-QabBt69U8myXYRDVU-1YiCo2k-JWRfu/view?usp=drivesdk",
"id": "1-QabBt69U8myXYRDVU-1YiCo2k-JWRfu",
"thumbnailLink": "https://lh3.googleusercontent.com/nhyq9mHrGDOZfNdQUHRj_xVlOoNAP5PEYkW4X2svGXKjVt53MvMGfjhQ2PlTv4cmv5-PgbjrR-c=s220"
},
"status": "success"
}
*/});
Argument name | Data type | Description | ||
URL | string | The third-party URL that has to be invoked from your extension. | ||
object | JSONObject | Key | Data type | Value |
|
| type | string | "GET" / "POST" / "PUT" / "DELETE" / "PATCH" |
|
| parameters | JSONObject | The request params of the API. |
|
| headers | JSONObject | The headers of the API. |
|
| body | JSONObject | The body of the API.
|
|
| files | JSONArray | The parameters for uploading a file. Value: the actual file. *The body will be ignored if actual file is uploaded *If you mention the type as binary, the file will sent as binary. The body of the file will also be considered |
|
| replace_secure_config | Boolean | If the is_secure parameter in the plugin-manifest.json file is true, set the value of this param to true. You can pass the values in the URL and object parameter in this format - {{name}} //name of the configuration Zoho Projects will replace the configuration value |
connection_link_name | string | The connection link name generated from the zapps website. You can get the connection link name from plugin-manifest. | ||
执行函数
在 Sigma 中执行自定义函数,无需触发器。执行该函数时必须提供 Function_uuid 及其版本号。
要检索自定义数据,请使用以下语法:
metaData = data.getJSON("parameters").getJSON("metadata").toMap();