Li Jun
2022-05-11 b776940205e893302f77d24c4285613f228b44c6
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
<?xml version="1.0" encoding="UTF-8"?>
<WebLink xmlns="http://soap.sforce.com/2006/04/metadata">
    <fullName>Complete</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;{!$User.Id}&quot; != &quot;00510000004reg2&quot; &amp;&amp; &quot;{!$User.Id}&quot; != &quot;00510000000gWAE&quot; &amp;&amp; &quot;{!$Profile.Id}&quot; != &quot;00e10000000Y3o5&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;;
    rac.RecordTypeId = &quot;01210000000Qeky&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>