You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Deluge函数中存储zoho.currenttime到DateTime字段时遇无效数据错误

问题解决:Zoho CRM DateTime字段数据格式错误

错误原因

Zoho CRM的datetime类型字段仅接受ISO 8601标准格式的时间字符串(例如2023-03-14T13:01:57Z),而你使用zoho.currenttime()获取的是本地化格式(14-Mar-2023 13:01:57),这种格式不被CRM API识别,因此触发INVALID_DATA错误。

解决方案

有两种简单的方式获取符合要求的时间格式:

方式1:直接使用zoho.currenttimeiso函数

这个函数会直接返回ISO 8601格式的当前时间,无需额外转换,是最简便的方案:

// 获取符合CRM要求的ISO格式时间
send_datetime = zoho.currenttimeiso;

方式2:用formatdate转换zoho.currenttime的结果

如果你一定要保留zoho.currenttime的使用,可以通过formatdate函数将其转换为ISO格式:

current_time = zoho.currenttime;
// 转换为ISO 8601格式
send_datetime = formatdate(current_time, "yyyy-MM-dd'T'HH:mm:ss'Z'");

完整示例代码

// 构造Request_Log记录数据
request_log = Map();
// 赋值正确格式的时间戳
request_log.put("Send_Date_Time", zoho.currenttimeiso);
// 添加其他字段(示例)
request_log.put("API_Response", "响应内容");
request_log.put("Request_URL", "https://api.example.com");

// 创建CRM记录
create_response = zoho.crm.createRecord("Request_Log", request_log);
info create_response;

内容的提问来源于stack exchange,提问作者markwilland

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.28 07:23:29