<?xml version="1.0" encoding="UTF-8"?> 
 | 
<WebLink xmlns="http://soap.sforce.com/2006/04/metadata"> 
 | 
    <fullName>SendQIS</fullName> 
 | 
    <availability>online</availability> 
 | 
    <displayType>button</displayType> 
 | 
    <linkType>javascript</linkType> 
 | 
    <masterLabel>发送QIS到SPO</masterLabel> 
 | 
    <openType>onClickJavaScript</openType> 
 | 
    <protected>false</protected> 
 | 
    <url>{!RequireScript("/soap/ajax/51.0/connection.js")}  
 | 
{!RequireScript("/resource/CommonUtilJs")}  
 | 
{!RequireScript("/soap/ajax/51.0/apex.js")}  
 | 
  
 | 
var foo = function() { 
 | 
  
 | 
if('{!QIS_Report__c.RecordTypeId}' == '01210000000RLWh'){ 
 | 
   alert('记录类型是:'+'{!QIS_Report__c.RecordType}'+',不能提交到SPO'); 
 | 
   return;  
 | 
} 
 | 
if(!('{!$Profile.Id }' == '00e10000000Y3o5' || '{!$Profile.Id }' == '00e10000000xnnu' || '{!$Profile.Id }' == '00e10000000xno9')) { 
 | 
    alert('没有权限提交,请联系系统管理员。'); 
 | 
    return;  
 | 
} 
 | 
  
 | 
if('{!QIS_Report__c.IsSendQIS__c}' == '1'){ 
 | 
    alert('已提交到SPO,请不要重复提交。'); 
 | 
    return; 
 | 
} 
 | 
/*var rac = new sforce.SObject("QIS_Report__c");  
 | 
rac.Id = "{!QIS_Report__c.Id}";  
 | 
  
 | 
rac.IsSendQIS__c = true ; 
 | 
  
 | 
var result = sforce.connection.update([rac]);  
 | 
var messages = getConnectDMLErrorMessages(result); 
 | 
  
 | 
if (messages.length > 0) {  
 | 
   alert(messages.join("\n"));  
 | 
    return; 
 | 
}*/ 
 | 
var qrId = '{!QIS_Report__c.Id}'; 
 | 
var rtn = sforce.apex.execute("QistoSPOWebService", "sendSPO", {qrId:qrId}); 
 | 
if (rtn != 'OK') { 
 | 
alert(rtn); 
 | 
return; 
 | 
}  
 | 
alert('提交成功!请在SPO系统中完成退换货申请。');  
 | 
location.reload(); 
 | 
open("https://olympus.sharepoint.cn/sites/GSPWF/SitePages/HomePage.aspx"); 
 | 
  
 | 
} 
 | 
  
 | 
foo();</url> 
 | 
</WebLink> 
 |