Li Jun
2022-04-08 ac719375874fd50fad5a11f8e04ac3329081bd0b
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>SI_Upsert_BTN</fullName>
    <availability>online</availability>
    <displayType>massActionButton</displayType>
    <linkType>javascript</linkType>
    <masterLabel>更新SI需求表</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;)} 
{!RequireScript(&quot;/resource/CommonUtilJs&quot;)} 
//2021-10-21 gwy 版本更改为51.0
var foo = function(){ 
var records = new Array(); 
if(&apos;{!Opportunity.RecordTypeId}&apos;==&apos;012100000006KMe&apos;){ 
//var result = sforce.connection.query(&quot;select id from IS_Opportunity_Demand__c where Opportunity_ID__c= &apos;{!Opportunity.Id}&apos; and Func_SOD_Status__c =&apos;00 已终止&apos;&quot;); 
var result2 = sforce.connection.query(&quot;select id from IS_Opportunity_Demand__c where Opportunity_ID__c= &apos;{!Opportunity.Id}&apos; and Func_SOD_Status__c !=&apos;00 已终止&apos;&quot;); 
records = result.getArray(&quot;records&quot;); 
alert(records.length+&apos;#####&apos;+strid.length);
var RecordTypeid = &apos;{!JSENCODE(Opportunity.RecordTypeId)}&apos;; 
if(RecordTypeid==&apos;012100000006KMe&apos;&amp;&amp; &apos;{!JSENCODE(Opportunity.Decided_Estimation__c)}&apos;!=&apos;&apos;){ 
alert(&quot;报价已决定,不能更新SI需求表&quot;); 
}else  if(records.length&gt;0&amp;&amp;RecordTypeid==&apos;012100000006KMe&apos;){
alert(&quot;存在的未终止SI需求表,不能更新SI需求表&quot;); 
}else {
if(RecordTypeid==&apos;012100000006KMe&apos;){
var url = &quot;apex/ISO_DemandOperAndDemons?abortID={!URLENCODE(Opportunity.Id)}&quot;; 
window.top.location.href=url; 
}
 
}
foo();</url>
</WebLink>