创建一个触发器:
trigger OpportunityTrigger on Opportunity (before update) {for (Opportunity opp : Trigger.new) {if (opp.CurrencyIsoCode != Trigger.oldMap.get(opp.Id).CurrencyIsoCode) {// 检查关联对象是否存在,假设关联对象是CustomObject__cList<CustomObject__c> relatedObjects = [SELECT IdFROM CustomObject__cWHERE Opportunity__c = :opp.Id];if (!relatedObjects.isEmpty()) {opp.addError('Currency field cannot be modified when related objects exist.');}}}
}