| <?xml version="1.0" encoding="UTF-8"?> | 
| <WebLink xmlns="http://soap.sforce.com/2006/04/metadata"> | 
|     <fullName>CustomLink</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")}  | 
| //2021-10-21 gwy 版本更改为51.0 | 
| var foo = function() { | 
|    var Status = "{!OPDPlan__c.Status__c}"; | 
|    if(Status == '取消' || Status == '完毕' ){ | 
|       alert('OPD计划的状态为取消或完毕时,不能取消'); | 
|       return; | 
|    } | 
|    //判断符合条件得备品借出申请 SWAG-BUF6J5  | 
|    var opdplanid = '{!OPDPlan__c.Id}';     | 
|    var rtn = sforce.apex.execute("OpdPlanWebService", "changeTrade",{opdplanId:opdplanid}); | 
|    if (rtn != 'OK') { | 
|      alert(rtn); | 
|      return; | 
|    } | 
|    window.open('/a3D/e?CF00N10000008ps4s={!OPDPlan__c.Name}&00N10000008ps4u=取消&RecordType=01210000000gQyL'); | 
| } | 
| foo();</url> | 
| </WebLink> |