Skip to content

Instantly share code, notes, and snippets.

@zaki-yama
Created May 8, 2015 10:20
Show Gist options
  • Select an option

  • Save zaki-yama/049e16da8c5b949ef668 to your computer and use it in GitHub Desktop.

Select an option

Save zaki-yama/049e16da8c5b949ef668 to your computer and use it in GitHub Desktop.
Salesforce: リストビューに一括削除ボタン
{!REQUIRESCRIPT('/soap/ajax/33.0/connection.js')};
var ids = {!GETRECORDIDS($ObjectType.Lead)},
idsStr = ids.toString().replace(/,/g, "','");
query = "SELECT Name FROM Lead WHERE Id IN ('" + idsStr + "')",
records = sforce.connection.query(query).getArray('records');
if (records.length === 0) {
alert('1つ以上選択してください');
} else {
var msg = records.length + '件のリードを削除します。\nよろしいですか?\n\n';
for (var i = 0; i < records.length; i++) {
msg += (i + 1) + ': ' + records[i].Name + '\n';
}
if (window.confirm(msg)) {
sforce.connection.deleteIds(ids);
window.location.reload();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment