この文章は Salesforce 機械翻訳システムを使用して翻訳されました。詳細はこちらをご参照ください。
英語に切り替える

OwnerChangeOptions

移行が行われた場合に、添付ファイル、メモ、および活動予定の所有者を指定します。

API コール

merge()update()upsert()

項目

要素名 説明
transferAttachments boolean

true の場合、レコードのメモ、添付ファイル、および Google ドキュメントが新しいレコード所有者に移行されます。false の場合、元のレコード所有が所有権を保持します。デフォルトは true です。

transferOpenActivites boolean

true の場合、レコードの活動予定が新しいレコード所有者に移行されます。false の場合、元のレコード所有が所有権を保持します。デフォルトは true です。

サンプルコード — Java

このサンプルでは、取引先と、取引先のメモおよび ToDo を作成し、メモと ToDo が新しい所有者に移行されるように所有者変更オプションを設定します。

1swfobject.registerObject("clippy.codeblock-0", "9");public void ownerChangeOptionsHeaderSample() {
2     
3    // Create account. Accounts don't transfer activities, notes, or attachments by default
4    
5    Account account = new Account();
6    account.setName("Account");
7    com.sforce.soap.enterprise.SaveResult[] sr = connection.create(new com.sforce.soap.enterprise.sobject.SObject[] { account } );
8    String accountId = null;
9
10    if(sr[0].isSuccess()) {
11        System.out.println("Successfully saved the account");
12        accountId = sr[0].getId();
13        
14        // Create a note and a task for the account
15        
16        Note note = new Note();
17        note.setTitle("Note Title");
18        note.setBody("Note Body");
19        note.setParentId(accountId);
20        
21        Task task = new Task();
22        task.setWhatId(accountId);
23        
24        sr = connection.create(new com.sforce.soap.enterprise.sobject.SObject[] { note, task } );
25        
26        if(sr[0].isSuccess()) {
27            System.out.println("Successfully saved the note and task");
28            
29           com.sforce.soap.enterprise.QueryResult qr = connection.query("SELECT Id FROM User WHERE FirstName = 'Jane' AND LastName = 'Doe'");
30           String newOwnerId = qr.getRecords()[0].getId();
31           account.setId(accountId);
32           account.setOwnerId(newOwnerId);
33           
34           // Set owner change options so account's child note & task transfer to new owner
35           
36           connection.setOwnerChangeOptions(true, true);
37           connection.update(new com.sforce.soap.enterprise.sobject.SObject[] { account } );
38           
39           // The account, account's note, & task should be transferred to the new owner.
40        }
41       
42   } else {
43       System.out.println("Account save failed: " + sr[0].getErrors().toString());
44    }
45}