【发布时间】:2021-10-22 00:14:12
【问题描述】:
我正在尝试在沙盒中对 Salesforce 的客户对象中的字段进行简单更新,但它似乎没有提交。我遵循以下拉取和更新记录的基础知识:
String accountId = '12345'
Account queriedAccount = [SELECT Id, Communication_Bubble__c FROM Account WHERE id = :accountId limit 1];
System.debug(queriedAccount);
// set the field i want to update
queriedAccount.Communication_Bubble__c = 'New Donor';
// update field
update queriedAccount;
// run select again to see if update went through
Account queriedAccount2 = [SELECT Id, Communication_Bubble__c FROM Account WHERE id = :accountId limit 1];
System.debug(queriedAccount2);
运行这段代码后查看日志显示更新已完成,因为我能够提取帐户并显示带有更新字段的帐户。以下是两个调试显示的内容:
Debug1:|Debug|Account:{Id=12345}(通信气泡为空)
Debug2:|Debug|Account:{Id=12345,Communication_Bubble=New Donor}
从上面看来,更新似乎完全按照它应该的方式工作。但是当我进入仪表板中的帐户时,或者在开发者控制台中查询“通信气泡”字段仍然为空白时。
似乎我错过了某种提交,但我无法弄清楚它是什么。
【问题讨论】:
标签: salesforce apex apex-code