<?xml version="1.0" encoding="UTF-8"?> 
 | 
<WebLink xmlns="http://soap.sforce.com/2006/04/metadata"> 
 | 
    <fullName>OSH_Nogoods</fullName> 
 | 
    <availability>online</availability> 
 | 
    <displayType>button</displayType> 
 | 
    <linkType>javascript</linkType> 
 | 
    <masterLabel>OSH无实物送达</masterLabel> 
 | 
    <openType>onClickJavaScript</openType> 
 | 
    <protected>false</protected> 
 | 
    <url>{!RequireScript("/soap/ajax/51.0/connection.js")} 
 | 
{!RequireScript("/resource/CommonUtilJs")}  
 | 
  
 | 
if ('{!QIS_Report__c.QIS_Status__c}' != 'OSH检测申请' && '{!QIS_Report__c.QIS_Status__c}' != '完毕') {  
 | 
    alert('OSH已经收到实物');  
 | 
} else { 
 | 
var rac = new sforce.SObject("QIS_Report__c"); 
 | 
rac.Id = "{!QIS_Report__c.Id}"; 
 | 
rac.QIS_Status__c = "OSH检测中"; 
 | 
var serverTimestamp = sforce.connection.getServerTimestamp(); 
 | 
rac.OSHRecievedDate__c = serverTimestamp.timestamp; 
 | 
rac.OSH_Receive_staff__c = "{!$User.Alias}"; 
 | 
rac.OSH_staff__c = "{!$User.Alias}"; 
 | 
rac.OSH_staff_email__c = "{!$User.Email}"; 
 | 
rac.Is_ProductGot__c = true;  
 | 
rac.OSH_GotProductPeople__c = "{!$User.Id}";  
 | 
var resultSet = sforce.connection.query("SELECT Id, JingliApprovalManager__c, BuchangApprovalManager__c, ZongjianApprovalManager__c FROM User WHERE Id = '{!$User.Id}'");  
 | 
var records = resultSet.getArray("records");  
 | 
if (records != null && records.length > 0 && records[0].JingliApprovalManager__c != null&& records[0].BuchangApprovalManager__c != null) {  
 | 
rac.OSH_Manager__c= records[0].JingliApprovalManager__c;  
 | 
rac.OSH_Buzhang__c= records[0].BuchangApprovalManager__c;  
 | 
} else {  
 | 
rac.OSH_Manager__c= "{!$User.Id}"; 
 | 
rac.OSH_Buzhang__c= "{!$User.Id}"; 
 | 
} 
 | 
rac.OSHInspectionDate__c = serverTimestamp.timestamp; 
 | 
rac.OSH_Nogoods__c = true; 
 | 
var result = sforce.connection.update([rac]); 
 | 
var messages = getConnectDMLErrorMessages(result); 
 | 
if (messages.length > 0) { 
 | 
    alert(messages.join("\n")); 
 | 
} 
 | 
location.reload(); 
 | 
}</url> 
 | 
</WebLink> 
 |