Created
May 8, 2015 10:20
-
-
Save zaki-yama/049e16da8c5b949ef668 to your computer and use it in GitHub Desktop.
Salesforce: リストビューに一括削除ボタン
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {!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