Li Jun
2022-04-13 5c01ebbfddb6b8674430b47c22977bea2e350084
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
39
40
41
42
43
<?xml version="1.0" encoding="UTF-8"?>
<WebLink xmlns="http://soap.sforce.com/2006/04/metadata">
    <fullName>Cancel</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;)} 
{!RequireScript(&quot;/resource/CommonUtilJs&quot;)} 
//2021-10-22 gwy 版本更改为51.0
var foo = function() {
    if (&quot;{!Report__c.Status__c}&quot; == &quot;取消&quot;) {
        alert(&quot;已经取消!&quot;);
        return;
    }
    if (&quot;{!Report__c.Status__c}&quot; == &quot;批准&quot;) {
        alert(&quot;已经批准,不能删除!&quot;);
        return;
    }
    if (&quot;{!Report__c.Status__c}&quot; == &quot;完毕&quot;) {
        alert(&quot;已经完毕,不能删除!&quot;);
        return;
    }
    if (&quot;{!Report__c.Status__c}&quot; == &quot;提交&quot;) {
        alert(&quot;已经提交,不能删除!&quot;);
        return;
    }
    var rac = new sforce.SObject(&quot;Report__c&quot;);
    rac.Id = &quot;{!Report__c.Id}&quot;;
    rac.Status__c = &quot;取消&quot;;
    var result = sforce.connection.update([rac]);
    messages = getConnectDMLErrorMessages(result);
    if (messages.length &gt; 0) {
        alert(messages.join(&quot;\n&quot;));
        return;
    }
    window.location.reload();
};
foo();</url>
</WebLink>