| <?xml version="1.0" encoding="UTF-8"?> | 
| <WebLink xmlns="http://soap.sforce.com/2006/04/metadata"> | 
|     <fullName>CustomSubmit</fullName> | 
|     <availability>online</availability> | 
|     <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")}  | 
|   | 
| var foo = function() { | 
|     if ('{!Rental_Apply_Equipment_Set__c.Request_extend_day__c}' == "" | 
|         || '{!Rental_Apply_Equipment_Set__c.Extend_request_reason__c}' == "") { | 
|         alert("必须填写延期希望结束日,延期申请理由"); | 
|         return; | 
|     } | 
|      | 
|     var rtn = sforce.apex.execute("RentalApplyWebService","postponeCheck",{endDate:'{!Rental_Apply_Equipment_Set__c.Rental_End_Date__c}',d:-5}); | 
|     if (rtn != "OK") { | 
|         alert(rtn); | 
|         return; | 
|     } | 
|   | 
|     var resultSet = sforce.connection.query("SELECT Id, JingliApprovalManager__c, SalesManager__c, BuchangApprovalManager__c, BuchangApprovalManagerSales__c, ZongjianApprovalManager__c FROM Rental_Apply__c WHERE Id = '{!Rental_Apply_Equipment_Set__c.Rental_ApplyId__c}'"); | 
|     var records = resultSet.getArray("records"); | 
|      | 
|     var rac = new sforce.SObject("Rental_Apply_Equipment_Set__c"); | 
|     rac.Id = "{!Rental_Apply_Equipment_Set__c.Id}"; | 
|     rac.JingliApprovalManager__c = records[0].JingliApprovalManager__c; | 
|     rac.SalesManager__c = records[0].SalesManager__c; | 
|     rac.BuchangApprovalManager__c = records[0].BuchangApprovalManager__c; | 
|     rac.BuchangApprovalManagerSales__c = records[0].BuchangApprovalManagerSales__c; | 
|     rac.ZongjianApprovalManager__c = records[0].ZongjianApprovalManager__c; | 
|     rac.Extend_Status__c = "填写完毕"; | 
|     var result = sforce.connection.update([rac]); | 
|     var messages = getConnectDMLErrorMessages(result); | 
|     if (messages.length > 0) { | 
|         alert(messages.join("\n")); | 
|         return; | 
|     } | 
|      | 
|     var request = new sforce.ProcessSubmitRequest(); | 
|     request.objectId = "{!Rental_Apply_Equipment_Set__c.Id}"; | 
|     var processResults = sforce.connection.process([request]); | 
|     if (processResults[0].errors != null) { | 
|         alert(processResults[0].errors.message); | 
|         return; | 
|     } | 
|     window.location.reload(); | 
| } | 
| foo();</url> | 
| </WebLink> |