Lead
見込みの、または潜在的な Opportunity を表します。
サポートされているコール
create()、delete()、describeLayout()、describeSObjects()、getDeleted()、getUpdated()、merge()、query()、retrieve()、search()、undelete()、update()、upsert()
項目
| 項目 | 詳細 |
|---|---|
| Address |
|
| AnnualRevenue |
|
| City |
|
| CleanStatus |
|
| Company |
|
| CompanyDunsNumber | |
| ConnectionReceivedId | |
| ConnectionSentId | |
| ConvertedAccountId |
|
| ConvertedContactId |
|
| ConvertedDate |
|
| ConvertedOpportunityId |
|
| Country |
|
| CountryCode |
|
| CurrencyIsoCode |
|
| Description |
|
| Division |
|
|
|
| EmailBouncedDate |
|
| EmailBouncedReason |
|
| Fax |
|
| FirstName |
|
| HasOptedOutOfEmail |
|
| Industry |
|
| IsConverted |
|
| IsDeleted |
|
| IsUnreadByOwner |
|
| Jigsaw |
|
| LastActivityDate |
|
| LastName |
|
| LastReferencedDate |
|
| LastViewedDate |
|
| 緯度 | |
| 経度 | |
| LeadSource |
|
| MasterRecordId |
|
| MiddleName |
|
| MobilePhone |
|
| Name |
|
| NumberOfEmployees |
|
| OwnerId |
|
| PartnerAccountId | |
| Phone |
|
| PhotoUrl |
|
| PostalCode |
|
| Rating |
|
| RecordTypeId |
|
| Salutation |
|
| State |
|
| StateCode |
|
| Status |
|
| Street |
|
| Suffix |
|
| Title |
|
| Website |
|
変換済みのリード
リードが Account、Contact、Opportunity (オプション) に変換されたことを示す特別な状況があります。クライアントアプリケーションは、convertLead() コールを使用してリードを変換することができます。また、ユーザはユーザインターフェースを使用してリードを変換することもできます。リードが変換されると、参照のみになります。変換されたリードは、更新または削除できません。ただし、変換されたリードレコードをクエリすることはできます。
リードには、変換された状況を示すいくつかの項目があります。これらの項目は、ユーザインターフェースでリードを変換する場合に設定されます。
- ConvertedAccountId
- ConvertedContactId
- ConvertedDate
- ConvertedOpportunityId
- IsConverted
- Status
未読のリード
リードには、リード所有者が参照していないまたは編集していないことを示す特別な状況があります。ユーザインターフェースでは、ユーザが割り当てられているがまだ処理されていないリードを知っておくことは役に立ちます。リード所有者がまだリードを参照も編集もしていない場合、IsUnreadByOwner 項目が true になります。リード所有者がリードを少なくとも一度は参照または編集している場合は false となります。
リード状況選択リスト
Status の値は、ユーザインターフェースで定義されているように、リード状況選択リストの変換された状況または変換されていない状況に対応します。選択リストでリードの状況値を取得するには、クライアントアプリケーションは、LeadStatus をクエリできます。
API によって、Status をリードが変換済みであることを示す状況値のいずれかに変更して、リードを変換することはできません。評価済みリードを取引先、取引先責任者、商談に変換する際に、リードに対して、変換済みであることを示す状況のタイプを 1 つ選択できます。こうしたタイプを割り当てられたリードは、レポートに含めることはできますが、[リード] タブには表示されなくなります。
使用方法
リードを更新する、または convertLead() を使用して変換するには、リードに対する「編集」権限でクライアントアプリケーションにログインしている必要があります。
リードを作成、更新、または更新/挿入すると、クライアントアプリケーションは、ユーザインターフェースで設定された割り当てルールに基づいて、リードを 1 つ以上の User レコードに自動的に割り当てることができます。
この機能を使用するために、クライアントアプリケーションは、create または update で使用する AssignmentRuleHeader に次のオプションのいずれか (両方ではない) を設定する必要があります。
Java のサンプル
次の Java のサンプルでは、新しく作成されたリードを自動的にどのように割り当てるかを示しています。
1swfobject.registerObject("clippy.codeblock-0", "9");
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17package com.doc.samples;
18import java.net.MalformedURLException;
19import java.net.URL;
20import java.rmi.RemoteException;
21import javax.xml.rpc.ServiceException;
22
23import com.sforce.soap.enterprise.LoginResult;
24import com.sforce.soap.enterprise.QueryResult;
25import com.sforce.soap.enterprise.SaveResult;
26import com.sforce.soap.enterprise.SforceServiceLocator;
27import com.sforce.soap.enterprise.SoapBindingStub;
28import com.sforce.soap.enterprise._AssignmentRuleHeader;
29import com.sforce.soap.enterprise._SessionHeader;
30import com.sforce.soap.enterprise.fault.LoginFault;
31import com.sforce.soap.enterprise.fault.UnexpectedErrorFault;
32import com.sforce.soap.enterprise.sobject.Lead;
33import com.sforce.soap.enterprise.sobject.SObject;
34
35public class LeadAssignment
36{
37
38 static LeadAssignment _leadAssignment;
39
40 public static void main(String[] args)
41 {
42 _leadAssignment = new LeadAssignment();
43 try {
44 _leadAssignment.CreateLead();
45 } catch (Exception e) {
46 e.printStackTrace();
47 }
48 }
49
50 public void CreateLead() throws UnexpectedErrorFault, LoginFault,
51 RemoteException, ServiceException
52 {
53 //Create the proxy binding and login
54 SoapBindingStub binding = (SoapBindingStub) new SforceServiceLocator().getSoap();
55 LoginResult lr = binding.login("user@domain.net", "secret");
56
57 //Reset the binding to use the endpoint returned from login
58 binding._setProperty(SoapBindingStub.ENDPOINT_ADDRESS_PROPERTY,
59 lr.getServerUrl());
60
61 //Create the session id header, and add it to the proxy binding
62 _SessionHeader sh = new _SessionHeader();
63 sh.setSessionId(lr.getSessionId());
64 binding.setHeader(
65 new SforceServiceLocator().getServiceName().getNamespaceURI(),
66 "SessionHeader", sh );
67
68 //Create a new case and assign various properties
69 Lead lead = new Lead();
70
71 lead.setFirstName("Joe");
72 lead.setLastName("Smith");
73 lead.setCompany("ABC Corporation");
74 lead.setLeadSource("API");
75 //The lead assignment rule will assign any new leads that
76 //have "API" as the LeadSource to a particular user
77
78 //Create the assignment rule header and add it to the proxy binding
79 _AssignmentRuleHeader arh = new _AssignmentRuleHeader();
80
81 //In this sample we will look for a particular rule and if found
82 //use the id for the lead assignment. If it is not found we will
83 //instruct the call to use the current default rule. You can't use
84 //both of these values together.
85 QueryResult qr = binding.query("Select Id From AssignmentRule where Name = " +
86 "'Mass Mail Campaign' and RuleType = 'leadAssignment'");
87 if (qr.getSize() == 0) {
88 arh.setUseDefaultRule(new Boolean(true));
89 } else {
90 arh.setAssignmentRuleId(qr.getRecords(0).getId());
91 }
92
93 binding.setHeader(
94 new SforceServiceLocator().getServiceName().getNamespaceURI(),
95 "AssignmentRuleHeader", arh);
96
97 // Every operation that results in a new or updated case, will
98 // use the specified rule until the header is removed from the
99 // proxy binding.
100 SaveResult[] sr = binding.create(new SObject[] {lead});
101 for (int i=0;i<sr.length;i++) {
102 if (sr[i].isSuccess()) {
103 System.out.println("Successfully created lead with id of: " +
104 sr[i].getId().getValue() + ".");
105 }
106 else {
107 System.out.println("Error creating lead: " +
108 sr[i].getErrors(0).getMessage());
109 }
110 }
111
112 // This call effectively removes the header, the next lead will
113 // be assigned to the default lead owner. Remember to add the
114 // session header back in.
115 binding.clearHeaders();
116 binding.setHeader(
117 new SforceServiceLocator().getServiceName().getNamespaceURI(),
118 "SessionHeader", sh);
119
120 }
121}C# のサンプル
次の C# のサンプルでは、新しく作成されたリードを自動的にどのように割り当てるかを示しています。
1swfobject.registerObject("clippy.codeblock-1", "9");
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17using System;
18using System.Collections.Generic;
19using System.Text;
20using LeadAssignment.sforce;
21
22namespace LeadAssignment
23{
24 class LeadAssignment
25 {
26 private SforceService binding;
27
28 private static readonly string Username = "ENTERUSERNAME";
29 private static readonly string Password = "ENTERPASSWORD";
30
31 /// <summary>
32 /// Create the proxy binding and login
33 /// </summary>
34 private LeadAssignment()
35 {
36 this.binding = new SforceService();
37 LoginResult lr = binding.login(LeadAssignment.Username, LeadAssignment.Password);
38
39 // Reset the binding to use the endpoint returned from login
40 this.binding.Url = lr.serverUrl;
41
42 // Create the session ID header and add it to the proxy binding
43 this.binding.SessionHeaderValue = new SessionHeader();
44 this.binding.SessionHeaderValue.sessionId = lr.sessionId;
45 }
46
47 [STAThread]
48 static void Main(string[] args)
49 {
50 LeadAssignment leadAssignment = new LeadAssignment();
51 try
52 {
53 leadAssignment.CreateLead();
54 }
55 catch (Exception e)
56 {
57 Console.WriteLine(e.Message);
58 Console.WriteLine(e.StackTrace);
59 Console.WriteLine(e.InnerException);
60 }
61 }
62
63 public void CreateLead()
64 {
65 // Create a new Lead and assign various properties
66 Lead lead = new Lead();
67
68 lead.FirstName = "John";
69 lead.LastName = "Brown";
70 lead.Company = "ABC Corporation";
71 lead.LeadSource = "Advertisement";
72 // Setting the lead source for a pre-existing lead assignment rule. This
73 // rule was created outside of this sample and will assign any new leads
74 // that have "Advertisement" as the LeadSource to a particular user
75
76 // Create the assignment rule header and add it to the proxy binding
77 AssignmentRuleHeader arh = new AssignmentRuleHeader();
78
79 // In this sample we will look for a particular rule and if found
80 // use the id for the lead assignment. If it is not found we will
81 // instruct the call to use the current default rule. Both these
82 // values can't be used together.
83 QueryResult qr = binding.query("Select Id from AssignmentRule where Name = " +
84 "'Mass Mail Campaign' and SobjectType = 'lead'");
85 if (qr.size == 0)
86 {
87 arh.useDefaultRule = true;
88 }
89 else
90 {
91 arh.assignmentRuleId = qr.records[0].Id;
92 }
93 binding.AssignmentRuleHeaderValue = arh;
94
95 // Every operation that results in a new or updated lead will use the
96 // specified rule until the header is removed from the proxy binding
97 SaveResult[] sr = binding.create(new sObject[] { lead });
98 foreach (SaveResult s in sr)
99 {
100 if (s.success)
101 {
102 Console.WriteLine("Successfully created Lead with ID: {0}", s.id);
103 }
104 else
105 {
106 Console.WriteLine("Error creating Lead: {0}", s.errors[0].message);
107 }
108 }
109
110 // This call effectively removes the header. The next lead will be assigned
111 // to the default lead owner.
112 binding.AssignmentRuleHeaderValue = null;
113 }
114 }
115}
116