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
39
40
41
<?xml version="1.0" encoding="UTF-8"?>
<WebLink xmlns="http://soap.sforce.com/2006/04/metadata">
    <fullName>CustomLink2Advance_Payment_Identification_Change</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;)}
 
var foo = function() {
    if (&apos;{!Account.FirstParagraph__c}&apos; == 0) {
        alert(&quot;您已取消先款标识,无需重复操作&quot;);
        return;
    } else if (&apos;{!Account.MonthlyPayment__c}&apos; == true) {
        alert(&quot;您不能进行特批,请先取消月度债权先款标识&quot;);
        return;
    } else {
        var AcId = &quot;{!Account.Id}&quot;;
        var sql = &quot;select id,Status__c from Advance_Payment__c where Account__c=&apos;&quot; + AcId + &quot;&apos; and RecordType.Id=&apos;01210000000aMKy&apos; and Status__c in (\&apos;草案中\&apos;,\&apos;已提交\&apos;,\&apos;批准中\&apos;)&quot;;
        var newRCPAED_IdList = sforce.connection.query(sql);
        var records = newRCPAED_IdList.getArray(&quot;records&quot;);
        if (records.length &gt; 0) {
            if (records[0].Status__c == &apos;草案中&apos;) {
                alert(&apos;已提交草稿请尽快提交审批&apos;);
            } else {
                alert(&apos;无法创建!已有未最终批准的数据&apos;);
            };
        } else {
             window.open(&quot;https://ocsm.my.salesforce.com/a4x/e?retURL=%2Fa4x%2Fo&amp;RecordType=01210000000aMKy&amp;ent=01I10000001YrgJ&amp;CF00N10000009HETA={!Account.Name}&amp;CF00N10000009HETA_lkid={!Account.Id}&quot;);
            //window.open(&quot;https://ocsm.my.salesforce.com/a4t/e?retURL=%2Fa4t%2Fo&amp;RecordType=0121m000000wouy&amp;CF00N1m000005eNIM={!Account.Name}&amp;CF00N1m000005eNIM_lkid={!Account.Name}&amp;ent=01I1m000000K82G&quot;)
        };
    }
 
 
}
foo();</url>
</WebLink>