binxie
2024-01-22 102afa21c115e8c8b9333a326c3d1af08fe76faf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?xml version="1.0" encoding="UTF-8"?>
<WebLink xmlns="http://soap.sforce.com/2006/04/metadata">
    <fullName>Cancel_Lead_Btn</fullName>
    <availability>online</availability>
    <displayType>button</displayType>
    <linkType>javascript</linkType>
    <masterLabel>取消</masterLabel>
    <openType>onClickJavaScript</openType>
    <protected>false</protected>
    <url>{!RequireScript(&quot;/soap/ajax/51.0/connection.js&quot;)} 
{!RequireScript(&quot;/soap/ajax/51.0/apex.js&quot;)} 
 
if (&apos;{!Lead.Cancel_Reason__c}&apos; == &apos;&apos;) { 
alert(&quot;请填写取消原因&quot;); 
} else { 
var result = sforce.connection.query(&quot;select id,Status from lead where id = &apos;{!Lead.Id}&apos;&quot;); 
var records = result.getArray(&quot;records&quot;); 
 
var Leadslist = new Array(); 
for (i = 0; i &lt; records.length; i++) { 
var Leads = new sforce.SObject(&quot;lead&quot;); 
Leads.id = records[i].Id;
Leads.Status = &apos;不要&apos;; 
Leadslist.push(Leads);  
 
if (Leadslist.length &gt; 0) { 
var updResult = sforce.connection.update(Leadslist); 
if (updResult[0].getBoolean(&quot;success&quot;)) { 
location.href = &quot;/{!URLENCODE(Lead.Id)}&quot;; 
}else{ 
var ermsg = updResult[0].errors.message; 
alert(ermsg); 
//alert(&quot;噗噗你个噗噗&quot;+records ); 
}</url>
</WebLink>