本文介绍了无法通过 SalesForce API (JSforce) 更新自定义日期字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Node.js 应用程序中的 JSforce 库来更新 Opportunity 对象上的自定义日期字段,但该字段并未更新.响应表明更新成功并且对象上的 SystemModstamp 字段已更新,但该字段仍为空.

I'm using the JSforce library from a Node.js app to update a custom date field on an Opportunity object, but the field is not being updated. The response indicates that the update is successful and the SystemModstamp field is updated on the object, however the field remains null.

这是我正在使用的 JSforce 调用:

This is the JSforce call I'm using:

conn.sobject("Opportunity").update({
    Id: opportunityId,
    Contract_Cancelled_Date__c: new Date("2018-09-13")
}, function(err, ret) {
    if (err) {
        console.log(err);
    } else {
        console.log(ret);
    }
});

我尝试将日期转换为字符串:(new Date("2018-09-13")).toIsoString().我也试过传入一个字符串常量:"2018-09-13T00:00:00.000Z".所有结果都相同.

I've tried converting the date to a string: (new Date("2018-09-13")).toIsoString().I've also tried passing in a string constant: "2018-09-13T00:00:00.000Z". All result in the same outcome.

我可以毫无问题地更新其他非日期自定义字段,并且我可以成功更新非自定义日期字段 CloseDate.

I'm able to update other non-date custom fields without issue and I'm able to update the non-custom date field CloseDate successfully.

推荐答案

我遇到了类似的问题(我使用了bulkApi).我能够使用以下YYYY-MM-DD"解决问题.尝试使用类似 moment(date).format('YYYY-MM-DD').

I had a similar problem (I used bulkApi). I was able to solve the problem using the following 'YYYY-MM-DD'. Try using something like moment(date).format('YYYY-MM-DD').

希望能帮到你.

这篇关于无法通过 SalesForce API (JSforce) 更新自定义日期字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-15 06:55