首页 > 解决方案 > Python - for 循环语句中的错误(更新到 salesforce)

问题描述

我有两列的数据框,即 Id 和 datetimehelp (保存时间戳值)。

下面给出的是数据框中的数据视图(account_update_subset)

Id,datetimehelp
123,18/05/18 9:50
234,NaT
567,18/05/18 9:45

我正在编写以下 Python 代码以对 Salesforce 对象进行此更新,但它向我抛出错误响应内容:{'exceptionCode':'InvalidBatch','exceptionMessage':'Records not processed'}

if len(account_update_subset) > 0:
    key_update_attributes_list = []
    update_attributes_list = []
    for i in range(len(account_update_subset)):
        update_attributes_data = {'Id': account_update_subset['Id'].iloc[i],
                              'datetimehelp': account_update_subset['datetimehelp'].iloc[i]}

        update_attributes_list.append(update_attributes_data)
        sf_data_cursor.bulk.Account.update(update_attributes_list)

谁能帮我找出这个 Python 脚本哪里出错了。谢谢

标签: pythonpython-3.xpandassalesforce

解决方案


推荐阅读