Li Jun
2022-04-25 784f9cec56eef3c7ac0ba02de98fdbf341c6a7b3
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
<?xml version="1.0" encoding="UTF-8"?>
<WebLink xmlns="http://soap.sforce.com/2006/04/metadata">
    <fullName>Split_Apply</fullName>
    <availability>online</availability>
    <displayType>massActionButton</displayType>
    <linkType>javascript</linkType>
    <masterLabel>分单</masterLabel>
    <openType>onClickJavaScript</openType>
    <protected>false</protected>
    <requireRowSelection>true</requireRowSelection>
    <url>{!RequireScript(&quot;/soap/ajax/51.0/connection.js&quot;)}
{!RequireScript(&quot;/soap/ajax/51.0/apex.js&quot;)}
//2021-10-22 gwy 版本更改为51.0
var foo = function() {
    
    var records = {!GETRECORDIDS($ObjectType.Consum_Apply_Equipment_Set__c)};
    if (records.length &lt; 1) { 
        alert(&quot;请选择耗材备品一览记录&quot;); 
    } else { 
        var raid = &apos;{!Consum_Apply__c.Id}&apos;;
        var soql = &quot;select RAES_Status__c from Consum_Apply_Equipment_Set__c where Consum_Apply__c=&apos;&quot; 
+ raid + &quot;&apos;&quot;; 
        var allRecords = sforce.connection.query(soql).getArray(&quot;records&quot;); 
        var validSize= allRecords .length; 
        if (validSize==1) {
            alert(&quot;这个申请单只有一条耗材备品一览,不能分单&quot;); 
        } else if(validSize == records.length) {
            alert(&quot;不能全选耗材备品一览分单&quot;);
        } else {
            window.open(&quot;/apex/ConsumApplySplit?objId={!URLENCODE(Consum_Apply__c.Id)}&amp;raesIds=&quot;+records, &apos;ConsumApplySplit&apos;, &apos;width=600,height=200&apos;);
        }        
    }
};
foo()</url>
</WebLink>