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

OwnerChangeOptions

レコードの所有者が変更されると実行できるアクションを表します。これらのオプションは、API バージョン 35.0 以降で使用できます。

API コール

update()upsert()

項目

要素名 説明
options OwnerChangeOption[]

update または upsert コールでレコード所有者を変更するときに実行する特定のアクションのフラグを表します。

OwnerChangeOption 項目

要素名 説明
execute boolean

true の場合、type 項目で表されるアクションが実行されます。false の場合、type 項目で表されるアクションがスキップされます。

type 文字列の列挙

update または upsert コールでレコード所有者を変更するときに execute 項目で指定された値に応じて実行またはスキップするアクションを表します。次の型を使用できます。

EnforceNewOwnerHasReadAccess
true の場合、レコードの新しい所有者に少なくともレコードへの参照アクセス権が必要です。API バージョン 36.0 以降で利用できます。
KeepAccountTeam
true の場合、取引先所有者が変更されたときに取引先と共に取引先チームが保持されます。false の場合、取引先チームは削除されます。デフォルトは false です。取引先で API バージョン 45.0 以降で使用できます。
KeepSalesTeam
true の場合、取引先所有者が変更されたときに商談と共に商談チームが保持されます。false の場合、商談チームは削除されます。デフォルトは false です。商談で API バージョン 45.0 以降で使用できます。
KeepSalesTeamGrantCurrentOwnerReadWriteAccess
true の場合、所有者が変更された後に商談の以前の所有者の「参照・更新」アクセス権が保持されます。デフォルトは false です。KeepSalesTeam が true の場合のみ true に設定できます。商談で API バージョン 44.0 以降で使用できます。
SendEmail
true の場合、メール通知は新しい所有者に送信されます。デフォルトは false です。
TransferAllOwnedCases
true の場合、取引先所有者が所有するすべてのケース (オープンとクローズ) が新しい所有者に移行されます。デフォルトは false です。TransferAllOwnedCases が true の場合、TransferOwnedOpenCases も true である必要があります。取引先で API バージョン 45.0 以降で使用できます。
TransferContacts
true で、レコードが法人取引先の場合、取引先に関連付けられている取引先責任者が新しい所有者に移行されます。
TransferContracts
true で、レコードが取引先の場合、取引先に関連付けられていて、取引先所有者が所有している契約が新しい所有者に移行されます。
TransferNotesAndAttachments
true の場合、レコードのメモ、添付ファイル、および Google ドキュメントが新しいレコード所有者に移行されます。false の場合、元のレコード所有者が所有権を保持します。
TransferOpenActivities
true の場合、レコードの活動予定が新しい所有者に移行されます。
TransferOrders
true で、レコードが取引先の場合、取引先に関連付けられているスタンドアロンのドラフト注文と、取引先所有者が所有している移行済み契約に関連付けられているドラフト注文が新しい所有者に移行されます。
TransferOtherOpenOpportunities
true で、レコードが取引先の場合、取引先に関連付けられていて、現在の所有者が所有していない進行中の商談が新しい所有者に移行されます。このオプションが実行される場合、TransferOwnedOpenOpportunities も実行されるよう設定する必要があります。デフォルトは false です。
TransferOwnedClosedOpportunities
true で、レコードが取引先の場合、取引先所有者が所有している完了した商談が新しい所有者に移行されます。デフォルトは false です。API バージョン 45.0 以降で使用できます。
TransferOwnedOpenCases
true で、レコードが取引先の場合、取引先所有者が所有しているオープンケースが新しい所有者に移行されます。デフォルトは false です。API バージョン 45.0 以降で使用できます。
TransferOwnedOpenOpportunities
true で、レコードが取引先の場合、取引先に関連付けられていて、取引先所有者が所有している進行中の商談が新しい所有者に移行されます。

サンプルコード —Java

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

1public void ownerChangeOptionsHeaderSample() {
2     
3    // Create account. Accounts don't transfer activities, notes, or attachments by default
4
5   
6    Account account = new Account();
7    account.setName("Account");
8    com.sforce.soap.enterprise.SaveResult[] sr = connection.create(new com.sforce.soap.enterprise.sobject.SObject[] { account } );
9    String accountId = null;
10
11    if(sr[0].isSuccess()) {
12        System.out.println("Successfully saved the account");
13        accountId = sr[0].getId();
14         
15        // Create a note, a task, and an opportunity for the account
16         
17        Note note = new Note();
18        note.setTitle("Note Title");
19        note.setBody("Note Body");
20        note.setParentId(accountId);
21         
22        Task task = new Task();
23        task.setWhatId(accountId);
24
25	 Opportunity opportunity = new Opportunity();
26        opportunity.setName("Opportunity");
27        opportunity.setStageName("Prospecting");
28        Calendar dt = connection.getServerTimestamp().getTimestamp();
29        dt.add(Calendar.DAY_OF_MONTH, 7);
30        opportunity.setCloseDate(dt);
31        opportunity.setAccountId(accountId);
32
33        sr = connection.create(new com.sforce.soap.enterprise.sobject.SObject[] { note, task, opportunity } );
34
35        if(sr[0].isSuccess()) {
36           System.out.println("Successfully saved the note, task, and opportunity");
37         
38          
39           com.sforce.soap.enterprise.QueryResult qr = connection.query("SELECT Id FROM User WHERE FirstName = 'Jane' AND LastName = 'Doe'");
40           String newOwnerId = qr.getRecords()[0].getId();
41           account.setId(accountId);
42           account.setOwnerId(newOwnerId);
43            
44           // Set owner change options so account's child note, task, and opportunity transfer to new owner
45    	   OwnerChangeOption opt1 = new OwnerChangeOption();
46	       opt1.setExecute(true);
47	       opt1.setType(OwnerChangeOptionType.TransferOwnedOpenOpportunities); // Transfer Open opportunities owned by the account's owner
48
49    	   OwnerChangeOption opt2 = new OwnerChangeOption();
50	       opt2.setExecute(true);
51	       opt2.setType(OwnerChangeOptionType.TransferOpenActivities);
52
53    	   OwnerChangeOption opt3 = new OwnerChangeOption();
54	       opt3.setExecute(true);
55	       opt3.setType(OwnerChangeOptionType.TransferNotesAndAttachments);
56
57    	   connection.setOwnerChangeOptions(new OwnerChangeOption[] {opt1, opt2, opt3});
58           connection.update(new com.sforce.soap.enterprise.sobject.SObject[] { account } );
59            
60           // The account's note, task, and opportunity should be transferred to the new owner.
61        }
62        
63   } else {
64       System.out.println("Account save failed: " + sr[0].getErrors().toString());
65    }
66}