| <?xml version="1.0" encoding="UTF-8"?> | 
| <WebLink xmlns="http://soap.sforce.com/2006/04/metadata"> | 
|     <fullName>Custom_Submit_BTN</fullName> | 
|     <availability>online</availability> | 
|     <description>{!RequireScript("/soap/ajax/30.0/connection.js")}  | 
| {!RequireScript("/soap/ajax/30.0/apex.js")}  | 
| {!RequireScript("/resource/CommonUtilJs")}  | 
|   | 
| var foo = function() { | 
|     if (!confirm("一旦提交此记录以待批准,根据您的设置您可能不再能够编辑此记录或将他从批准过程中调回。是否继续?")) { | 
|         return; | 
|     } | 
|     //确认已经检查过完整性 | 
|     if ('{!IS_Opportunity_Demand__c.Data_Check_TF__c}' !=true ) { | 
|         alert('请先在编辑页面,检查数据完整性,然后再执行提交'); | 
|         return; | 
|     } | 
|         if('{!IS_Opportunity_Demand__c.CAD_Upload_Date__c}' == ''){ | 
|                 alert('CAD未上传,需求表不能提交批准'); | 
|                 return; | 
|         } | 
|     var submit = sforce.apex.execute('ControllerUtil','ISO_Submit_Func',{isoID:'{!IS_Opportunity_Demand__c.Id}'}); | 
|     if (submit != 'Fin') { | 
|         alert(submit); | 
|         return; | 
|     } | 
|     window.location.reload(); | 
| }; | 
| foo();</description> | 
|     <displayType>button</displayType> | 
|     <linkType>javascript</linkType> | 
|     <masterLabel>提交审批</masterLabel> | 
|     <openType>onClickJavaScript</openType> | 
|     <protected>false</protected> | 
|     <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() { | 
|     if (!confirm("一旦提交此记录以待批准,根据您的设置您可能不再能够编辑此记录或将他从批准过程中调回。是否继续?")) { | 
|         return; | 
|     } | 
|     //确认已经检查过完整性 | 
|     //if ('{!IS_Opportunity_Demand__c.Data_Check_TF__c}' !=true ) { | 
|         //alert('请先在编辑页面,检查数据完整性,然后再执行提交'); | 
|         //return; | 
|     //} | 
|         if ('{!IS_Opportunity_Demand__c.Data_Check_TF__c}' !=true ) { | 
|         alert('请营业担当提交审批!'); | 
|         return; | 
|     } | 
|         //状态为终止的不能提交审批 | 
|         if('{!IS_Opportunity_Demand__c.Func_SOD_Status__c}' == '00 已终止'){ | 
|                 alert('需求表已终止不能提交审批'); | 
|                 return; | 
|         } | 
|         //取消CAD上传的限制 by vivek 2019-10-28 start | 
|         //if('{!IS_Opportunity_Demand__c.CAD_Upload_Date__c}' == ''){ | 
|         //        alert('CAD未上传,需求表不能提交批准'); | 
|         //        return; | 
|         //} | 
|         //取消CAD上传的限制 by vivek 2019-10-28 end | 
|         //CHAN-BEN68Z 【委托】SI项目需求表权限控制优化 start | 
|         window.$Label = window.$Label || {}; | 
|         $Label.customLabel= '{!($Label.ProfileId_SystemAdmin)}'; | 
|         var label =  $Label.customLabel; | 
|          | 
|         sforce.connection.sessionId = "{!$Api.Session_ID}";  | 
|         var isopd = new sforce.SObject("IS_Opportunity_Demand__c");  | 
|         isopd.Id = "{!IS_Opportunity_Demand__c.Id}";  | 
|         isopd.Submint_TF__c = true;  | 
|         try {  | 
|                 var result = sforce.connection.update([isopd]);  | 
|                 var messages = getConnectDMLErrorMessages(result);  | 
|                 if (messages.length > 0) {  | 
|                         alert(messages.join("\n"));  | 
|                         return;  | 
|                 }  | 
|         } catch (err) {  | 
|                 if(err.faultstring !=undefined && err.faultstring.indexOf('INVALID_SESSION_ID') != -1) {  | 
|                         alert('当前网页已登出,请您重新登录后刷新该网页!');  | 
|                 } else {  | 
|                         alert(err.faultstring);  | 
|                 }  | 
|                 return;  | 
|         } | 
|          | 
|         //CHAN-BEN68Z 【委托】SI项目需求表权限控制优化 end | 
|     window.location.reload(); | 
| }; | 
| foo();</url> | 
| </WebLink> |