我想编写根据“主要联系人”字段更新帐户表单(address1_city 字段)的 JavaScript 代码,我需要检索正确的联系人城市并使用此值更新帐户城市。
我怎样才能做到这一点?
我有一个返回第一个联系人的函数:
function getFirstContactToBePrimaryContact(contactName)
{
SDK.REST.retrieveMultipleRecords("Contact", "$select=FullName",
function (results)
{
var firstResult = results[0];
if (firstResult != null)
{
if(contactName == firstResult)
{
returnValue = getcity(firstResult);
return;
}
}
else
{
//document.write("No Contact records are available to set as the primary contact for the account.");
}
}, errorHandler, function () { /*OnComplete handler*/ }
);
}