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>CustomSubmit</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() {
    var resultSet = sforce.connection.query(&quot;SELECT Id, JingliApprovalManager__c, SalesManager__c, BuchangApprovalManager__c, BuchangApprovalManagerSales__c, ZongjianApprovalManager__c FROM Rental_ApplyConsum__c WHERE Id = &apos;{!Consum_Apply_Equipment_Set__c.Consum_ApplyId__c}&apos;&quot;);
    var records = resultSet.getArray(&quot;records&quot;);
    
    var rac = new sforce.SObject(&quot;Rental_Apply_Equipment_SetConsum__c&quot;);
    rac.Id = &quot;{!Consum_Apply_Equipment_Set__c.Id}&quot;;
    rac.JingliApprovalManager__c = records[0].JingliApprovalManager__c;
    rac.SalesManager__c = records[0].SalesManager__c;
    rac.BuchangApprovalManager__c = records[0].BuchangApprovalManager__c;
    rac.BuchangApprovalManagerSales__c = records[0].BuchangApprovalManagerSales__c;
    rac.ZongjianApprovalManager__c = records[0].ZongjianApprovalManager__c;
    rac.Extend_Status__c = &quot;填写完毕&quot;;
    var result = sforce.connection.update([rac]);
    var messages = getConnectDMLErrorMessages(result);
    if (messages.length &gt; 0) {
        alert(messages.join(&quot;\n&quot;));
        return;
    }
    
    var request = new sforce.ProcessSubmitRequest();
    request.objectId = &quot;{!Consum_Apply_Equipment_Set__c.Id}&quot;;
    var processResults = sforce.connection.process([request]);
    if (processResults[0].errors != null) {
        alert(processResults[0].errors.message);
        return;
    }
    window.location.reload();
}
foo();</url>
</WebLink>