| <?xml version="1.0" encoding="UTF-8"?> | 
| <WebLink xmlns="http://soap.sforce.com/2006/04/metadata"> | 
|     <fullName>sendReport</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_Fault__c.FaultDesc__c}' == ''|| '{!Rental_Apply_Fault__c.Reply_message__c}' == '' ){ | 
|         alert('【故障描述】和【损坏原因分析及预防建议】不能为空'); | 
|         return;  | 
|       } | 
|     if('{!Rental_Apply_Fault__c.status__c}' != '草案中' &&  '{!Rental_Apply_Fault__c.status__c}' != ''){ | 
|         alert('只有草案中的检测分析报告才能发送报告'); | 
|         return; | 
|     } | 
|   | 
|     var ra = new sforce.SObject("Rental_Apply_Fault__c"); | 
|     ra.Id = "{!Rental_Apply_Fault__c.Id}"; | 
|     ra.status__c = '已发送'; | 
|     var result = sforce.connection.update([ra]); | 
|     var messages = getConnectDMLErrorMessages(result); | 
|     if (messages.length > 0) { | 
|         alert(messages.join("\n")); | 
|         return; | 
|     } | 
|     alert('报告已发送'); | 
|     window.location.reload(); | 
| } | 
| foo();</url> | 
| </WebLink> |