我在Salesforce中有一个名为Website_Role__c的自定义对象。此对象具有与具有不同角色的商店(所有者,导师等)关联的人员列表。
在帐户的Salesforce按钮中使用JavaScript:
用户单击该按钮时会出现所需的行为,并弹出一个对话框,其中显示该帐户的Website_Role__c中的人员列表。每个人旁边都会有一个复选框,允许用户选择它们。
我们正在使用eSign(以前称为EchoSign)。此按钮是“使用eSign发送”按钮,用于将协议发送到Website_Role__c的人员列表。
这就是我现在所处的位置:
/*My Attempt*/
{
!REQUIRESCRIPT("/soap/ajax/19.0/connection.js")
} //adds the proper code for inclusion of AJAX toolkit
var url = parent.location.href; //string for the URL of the current page
var records = {!GETRECORDIDS($ObjectType.Website_Role__c)
}; //grabs the Website Role records for the currently selected store
var updateRecords = []; //array for holding records that this code will ultimately update
if (records[0] == null) { //if the button was clicked but there was no record selected
alert("Please select at least one person to send to."); //alert the user that they didn't make a selection
} else { //otherwise, there was a person selected
for (var a = 0; a < records.length; a++) { //for all records
var update_Website_Role__c = new sforce.SObject("Website_Role__c"); //create a new sObject for storing updated record details
//This is where I get lost. Not sure if this is even the correct approach
}
//??
parent.location.href = url; //refresh the page
}
我非常感谢您提供的任何帮助。 谢谢
答案 0 :(得分:0)
尝试这样的事情:
{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")}
var query = sforce.connection.query("SELECT Owner__c, Mentor__c FROM Website_Role__c WHERE Account__c ='{!Account.Id}'");
var records = query.getArray("records");
alert("Owner is: " + records[0].Owner__c);
这假设您的Website_Role对象上有一个指向该帐户的引用字段。 点击这里查看更多示例 https://developer.salesforce.com/docs/atlas.en-us.ajax.meta/ajax/sforce_api_ajax_more_samples.htm