You need to sign in to do that
Don't have an account?
Asel Vazir 1
I need to call the trigger from the class that has a validation rule on custom fields
public with sharing class FieldnotEmptycontrl { public static Property__c field {get; set;} public FieldnotEmptycontrl(){ field = new Property__c(); } public static void fieldNotEmpty(List<Property__c> prop){ if(field.Business__c == null || field.Contact__c == null){ field.Business__c.addError('You must enter a value!'); field.Contact__c.addError('You must enter a value!'); if(field.Business__c != null && field.Contact__c != null){ field.Business__c.addError('Cannot use two fields at the same time. Please choose only one field Business or Contact'); field.Contact__c.addError('Cannot use two fields at the same time. Please choose only one field Business or Contact'); } } } }Here is the Trigger calling the above class and method, but it shows the error • triggers/fieldNotEmpty.trigger: ERROR at line 1, column 1 - Must specify the metadata file
trigger fieldNotEmpty on Property__c (before insert, before update, after insert) { if (Trigger.isBefore) { if(Trigger.isInsert){ FieldnotEmptycontrl.fieldNotEmpty(Trigger.new); } } }Please help me to resolve the issue
Regards
Andrew
All Answers
Was the trigger renamed? Using your IDE/Editor, review if the Trigger has an associated XML file and that the file has the same name as the trigger.
Regards
andrew
Regards
Andrew