<?xml version="1.0" encoding="UTF-8"?> 
 | 
<WebLink xmlns="http://soap.sforce.com/2006/04/metadata"> 
 | 
    <fullName>Submit_report</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("/resource/CommonUtilJs")}  
 | 
var foo = function() { 
 | 
  
 | 
if (!confirm("一旦提交此记录以待批准,根据您的设置您可能不再能够编辑此记录或将他从批准过程中调回。是否继续?")) { 
 | 
  return; 
 | 
} 
 | 
  
 | 
var rac = new sforce.SObject("Opponent_Bid_Information__c");  
 | 
rac.Id = "{!Opponent_Bid_Information__c.Id}";  
 | 
rac.Report_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 = "{!Opponent_Bid_Information__c.Id}"; 
 | 
var processResults = sforce.connection.process([request]); 
 | 
  
 | 
if (processResults[0].errors != null) { 
 | 
  var back = new sforce.SObject("Opponent_Bid_Information__c"); 
 | 
  back.Id = "{!Opponent_Bid_Information__c.Id}"; 
 | 
  back.Report_Status__c = "草案"; 
 | 
  var backResult = sforce.connection.update([back]); 
 | 
  backMessages = getConnectDMLErrorMessages(backResult); 
 | 
  if (backMessages.length > 0) { 
 | 
    alert(backMessages.join("\n")); 
 | 
    return; 
 | 
  } 
 | 
  
 | 
  var errmsg = processResults[0].errors.message.toString(); 
 | 
  alert(errmsg); 
 | 
  return; 
 | 
} 
 | 
  
 | 
window.location.reload(); 
 | 
}; 
 | 
  
 | 
foo();</url> 
 | 
</WebLink> 
 |