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