| <?xml version="1.0" encoding="UTF-8"?> | 
| <ValidationRule xmlns="http://soap.sforce.com/2006/04/metadata"> | 
|     <fullName>When_NFM103_With_Repairing</fullName> | 
|     <active>true</active> | 
|     <description>2016/11/10 add condition | 
|   NOT(Delivered_Product__r.Product2.CanRepairAccsessary__c = true | 
|    && text(Delivered_Product__r.Asset_Owner__c) <> "Olympus" | 
| 2016/12/6 add condition | 
|   Not Serial Tracing&&Not备品用途附属品</description> | 
|     <errorConditionFormula>AND( | 
|   OR( | 
|     Text(Status__c)='草案中', | 
|     Text(Status__c)='1.受理完毕', | 
|     Text(Status__c)='0.申请完毕' | 
|   ), | 
|   OR( | 
|     ISNEW(), | 
|     AND(ISCHANGED(Status__c),  Text(PRIORVALUE(Status__c))='草案中') | 
|   ), | 
|   /* 已经有修理 */ | 
|    Delivered_Product__r.Repairing_Count__c >= 1 , | 
|   /* 可以修理附属品=false&&备品&&Not Serial Tracing&&Not备品用途附属品)*/ | 
|    OR( | 
|      Delivered_Product__r.Product2.CanRepairAccsessary__c = false, | 
|      Delivered_Product__r.Product2.CanRepairAccsessary__c = true | 
|      && text(Delivered_Product__r.Asset_Owner__c) = "Olympus" | 
|      && Delivered_Product__r.Product2.Serial_Lot_No__c = "S/N tracing" | 
|      && Delivered_Product__r.Loaner_accsessary__c = false | 
| ) | 
| )</errorConditionFormula> | 
|     <errorDisplayField>Delivered_Product__c</errorDisplayField> | 
|     <errorMessage>已经有受理完毕的修理,不能再受理了</errorMessage> | 
| </ValidationRule> |