Salesforce的日期时间问题日期、时间、问题、Salesforce

2023-09-03 21:41:26 作者:伤心了就哭吧

我目前正在写一个C#.NET应用程序,使得使用Salesforce的API的。我送帐户对象有日期时间字段。

我的datetime对象都在这个格式为DD / MM / YYYY HH:MM:SS,这也是我做一个简单的查询时返回的日期字段的格式相同选择名称,日期从户口所在ID = NULL! - 我已经设置了一个测试帐户的日期在Salesforce中手动前查询。我已经检查一切,是因为有日期格式,我相信我发送正确的数据类型和日期时间格式到Salesforce。

我的问题是Salesforce的,似乎离开日期字段为空。任何人都知道的一种方式,我可以保证的Salesforce正在接受最新的详细信息。

 的DateTimeFormatInfo dtfi =新的DateTimeFormatInfo();
dtfi.FullDateTimePattern =DD / MM / YYYY HH:MM:SS;
dtfi.DateSeparator =/;
字符串_TempRangeEndDate =2013年8月31日
日期时间objDateRangeEnd = Convert.ToDateTime(_TempRangeEndDate,dtfi);
_TempAccount.Date_End__c = objDateRangeStart; // Salesforce的不接受转换后的格式,这是31/08/2013 00:00:00
 

解决方案

在.NET SOAP堆栈没有你设置附加speciified标志将不会发送日期时间(和一些其他灵长类动物的类型,如数字),例如:

  _TempAccount.Date_End__c = DateTime.Now;
_TempAccount.Date_End__c_Specified = TRUE;
 

如果您没有设置该标志的.NET SOAP堆栈不序列化元素和它永远不会被发送到Salesforce。 (等等领域保持空白)

云巨头深陷高管离职风波 三千亿美元市值已蒸发一大半

I am currently writing a c# .Net application that makes use of the salesforce API. I am sending account objects with datetime fields.

my datetime objects are all in this format "dd/MM/yyyy HH:mm:ss" which is also the same format of the date fields that is returned when I do a simple query "SELECT Name, Date FROM Account WHERE ID != null" - I have set a date in the a test account in salesforce manually prior to the query. I have checked everything that has to do with date format and I am confident that I am sending the correct datatype and datetime format to salesforce.

My problem is Salesforce seems to leave the Date field blank. Anyone know of a way I can make sure Salesforce is accepting the date details.

DateTimeFormatInfo dtfi = new DateTimeFormatInfo();
dtfi.FullDateTimePattern = "dd/MM/yyyy HH:mm:ss";
dtfi.DateSeparator = "/";
string _TempRangeEndDate = "2013-08-31"
DateTime objDateRangeEnd = Convert.ToDateTime(_TempRangeEndDate,dtfi);
_TempAccount.Date_End__c = objDateRangeStart; //Salesforce not accepting converted format which is "31/08/2013 00:00:00"

解决方案

the .NET SOAP stack won't send dateTimes (and some other primative types like numbers) without you setting the additional speciified flag, e.g.

_TempAccount.Date_End__c = DateTime.Now;
_TempAccount.Date_End__c_Specified = True;

If you don't set this flag the .NET Soap stack doesn't serialize that element and its never sent to salesforce. (and so the field remains blank)